Answer the question
In order to leave comments, you need to log in
How to send HTTP request from PHP when working with API?
I have this documentation https://pechkin.com/api/
But I am very far from PHP and sending POST requests.
Push in the right direction, or let me read something intelligible.
Now the task is simple:
Write the user's name, phone number and mail to the subscriber base.
All this must be done when he clicks "Leave a request".
The PHP handler is extremely simple.
<?php
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$to = '@.';
$subject = 'Обратный звонок';
$message = '
<html>
<head>
<title>'.$subject.'</title>
</head>
<body>
<p>Имя: '.$name.'</p>
<p>Телефон: '.$phone.'</p>
<p>E-mail: '.$email.'</p>
</body>
</html>';
$headers = "Content-type: text/html; charset=utf-8 \r\n";
$headers .= "From: Отправитель <@.>\r\n";
mail($to, $subject, $message, $headers);
?>
Answer the question
In order to leave comments, you need to log in
For example like this:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $arr);
$out = curl_exec($curl);
curl_close($curl);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question