【问题标题】:Sending SMS through PHP and curl (invalid number status 400)通过PHP和curl发送短信(无效号码状态400)
【发布时间】: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.phpbuy.techsolsms.com/Login-Area.php - 使服务按预期运行。
  • 我刚刚在消息中输入了“test”或“test message”。
  • 请阅读:“确保确保服务按预期运行
  • 好的,我会试试的。感谢您的回复

标签: php api curl sms


【解决方案1】:

状态 400 - HTTP 代码,错误请求(无效编号)

查看 API 文档,可能是您发送的电话号码格式无效。

【讨论】:

    猜你喜欢
    • 2017-07-17
    • 2015-01-04
    • 2021-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    相关资源
    最近更新 更多