【发布时间】:2018-10-11 06:19:01
【问题描述】:
我想通过 PHP 和 curl 发送短信。但它的反应是
“状态:400”,无效数字,数据:null”。
请检查我的代码我做错了什么。这是我的代码。
$number='*****';
$toPost = array(
"Authkey"=>"******",
"Mask"=>'*****',
"user" => $username,
"pass" => $password,
"to" => $number,
"sender" => urlencode($from),
"text" => urlencode($message),
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://buy.techsolsms.com/api/v1/quicksms.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $toPost);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // If you use this line, you will get response from API in $result below.
$result = curl_exec($ch);
echo "<span class='alert alert-success'> '$result'</span>" ;
echo "<script>alert('$result')</script>";
curl_close($ch);
【问题讨论】:
-
您的邮件中可能有
unescaped字符。您是否还会收到错误消息,例如发送hello之类的简单消息? - 注意:该网站有几个断开的链接 - buy.techsolsms.com/signup.php 或 buy.techsolsms.com/Login-Area.php - 使服务按预期运行。 -
我刚刚在消息中输入了“test”或“test message”。
-
请阅读:“确保确保服务按预期运行
-
好的,我会试试的。感谢您的回复