PHP
- 11 ответов
- 0 вопросов
8
Вклад в тег
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.localhost.com/wp-admin/admin-ajax.php?action=ihf_contact_form_request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{contactName: \"qwer\", email: \"test3@gmail.com\" }",
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}