I am running the following code and getting this error:
Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.
<?php
$phone = "1236547895";
$message = 'Dear '.$firstname.' '.$lastname.',
Your invoice (#'.$invoiceid.') is successfully paid on '.$datepaid.' at Hostomy. Thank you for choosing us.
Regards,
Hostomy
';
$url = "https://www.example.com/file.php?phone=".$phone."&message=".$message."";
$ch = curl_init();
$timeout = 10;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
?>
尝试urlencode消息和$ phone vars:
$url = "https://www.example.com/file.php?phone=".urlencode($phone)."&message=".urlencode($message)."";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.