当我在 PHP 中通过 fopen($url, "r")
请求 URL 时收到"错误 2912"
例:它实际上是在短信API上。我启动了一些变量来替换一些必填字段。
$url = api.smartsmssolutions.com/smsapi.php?username=myusername&password=mypassword&sender=".$sender."&recipient=".$d3."&message=".$const_msg;
根据错误 2912,您的收件人为空。给出的正确格式是
http://api.smartsmssolutions.com/smsapi.php?username=YourUsername&password=YourPassword&sender=SenderID&recipient=234809xxxxxxx,2348030000000&message=YourMessage
通过更改网址进行检查,如下所示
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
$sender = "YOUR_ID";
$d3 = "2348922223,2569878987";
$const_msg = "YOUR_MESSAGE";
$url = "http://api.smartsmssolutions.com/smsapi.php?username={$username}&password={$password}&sender={$sender}&recipient={$d3}&message={$const_msg}";
Error code 2912=Recipient is empty.
请检查参数发送的值是否正确。
问题是变量没有正确启动。我不得不使用 UrlEncode() 将变量解析为 fopen($url)。
喜欢这个。
$urlt = "http://api.smartsmssolutions.com/smsapi.php?username="。UrlEncode($username)。&密码="。UrlEncode($password)。&发件人=" 。网址编码($sender)."&收件人=234" .网址编码($d 3).",&消息=" .UrlEncode($const_msg);