[英]Receiving sms fails on Nexmo Send Sms
I've looked for similar topics and could't find any solutions, I'm hoping someone can help me..我一直在寻找类似的主题,但找不到任何解决方案,我希望有人可以帮助我..
Note: I'm running the script on xampp localhost and my country code is +90 I've followed the Nexmo documentation to send an sms.注意:我在 xampp localhost 上运行脚本,我的国家/地区代码是 +90 我已按照 Nexmo 文档发送短信。 and below is the php script.下面是php脚本。
<?php
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
[
'api_key' => 'xxxxxxxx',
'api_secret' => 'xxxxxxxxxxx',
'to' => 90542xxxxxxx,
'from' => 'MyCompanyName',
'text' => 'Working'
]
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;
?>
and the following is the outcome.以下是结果。 it seems like it is sending it however I'm not receiving a sms on my mobile what could possibly cause this?它似乎正在发送它但是我没有在我的手机上收到一条短信,这可能是什么原因造成的?
{ "message-count": "1", "messages": [{ "to": "90542xxxxxxx", "message-id": "0C00000016FF36E9", "status": "0", "remaining-balance": "1.77080000", "message-price": "0.01910000", "network": "28602" }] }
Reasons why the SMS may not have been delivered:短信未送达的原因:
NXSMS
.在这种情况下,Nexmo 会将发件人 ID 更改为NXSMS
。 For details on support of alphanumeric sender ID see: https://docs.nexmo.com/messaging/sms-api/building-global-apps#country_specific_features有关支持字母数字发件人 ID 的详细信息,请参阅: https : //docs.nexmo.com/messaging/sms-api/building-global-apps#country_specific_features One way to improve the chances of deliverability is to use a from
number that has been bought through Nexmo.改善产能的机会的一种方法是使用from
已通过Nexmo买号。 In these examples there is also a callback
parameter set so that the application is informed of the SMS delivery.在这些示例中,还有一个callback
参数集,以便应用程序获知 SMS 传送。
Using using the Nexmo PHP client library :使用Nexmo PHP 客户端库:
<?php
$client = new Nexmo\Client(new Nexmo\Client\Credentials\Basic(API_KEY, API_SECRET));
$message = $client->message()->send([
'to' => '90542xxxxxxx',
'from' => '90555xxxxxxx',
'text' => 'Working',
'callback' => 'https://example.com/dlr;
]);
Or based on the code in the question:或者根据问题中的代码:
<?php
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
[
'api_key' => 'xxxxxxxx',
'api_secret' => 'xxxxxxxxxxx',
'to' => '90542xxxxxxx',
'from' => '90555xxxxxxx',
'text' => 'Working',
'callback' => 'https://example.com/dlr;
]
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;
Related: Nexmo FAQ on SMS delivery in Turkey相关: Nexmo 关于在土耳其发送短信的常见问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.