[英]nexmo sms api is not working
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
[
'api_key' => 'xxxxx',
'api_secret' => 'xxxxxxx',
'to' => $mobile,
'from' => 'ABC',
'text' => $message,
]
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
This api is not working and not showing any error. 这个api不工作,没有显示任何错误。 I used only this code to send sms anything other is also needed? 我只使用此代码发送短信还需要其他任何东西吗? I used api_key and secret correct. 我用api_key和秘密正确。
assuming that you checked values of $mobile and $message before using and that they're ok 假设您在使用之前检查了$ mobile和$ message的值,并且它们没问题
EDIT: error_reporting(E_ALL); ini_set('display_errors', 1);
编辑: error_reporting(E_ALL); ini_set('display_errors', 1);
error_reporting(E_ALL); ini_set('display_errors', 1);
on top of your page and check updated code 在页面顶部并检查更新的代码
EDIT 2: 编辑2:
It works only with your registered phone number with trial API and with registered number as dest This is meant to avoid spam 它只能与已注册的电话号码,可与试验API,并与注册号为DEST这是为了避免垃圾邮件
You need to put $mobile
and $message
like this: 你需要把$mobile
和$message
这样:
error_reporting(E_ALL); ini_set('display_errors', 1);
print_r($_POST);
echo"[ num: $mobile / mess: $message]";
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query(
[
'api_key' => 'xxxxx',
'api_secret' => 'xxxxxx',
'to' => ''.$mobile.'', /* dest phone number */
'from' => '33012345678', /* my own phone number */
'text' => ''.$message.'' /* my message */
]
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.