【问题标题】:Twilio Messages are not sending in PHPTwilio 消息未在 PHP 中发送
【发布时间】:2016-11-02 08:32:34
【问题描述】:

我正在使用 twilio api 发送消息。 以下是我的脚本。

$AccountSid = "xxxxxxxxxxxxx";
$AuthToken = "xxxxxxxxxxxx";
$from = 'xxxxxxx';
$to = '+91xxxxxxxxxxxxx';

$uri = 'https://api.twilio.com/2010-04-01/Accounts/' .$AccountSid . '/SMS/Messages';
$auth = $AccountSid . ':' . $AuthToken;

$fields = '&To='.urlencode( $to ).'&From='.urlencode($from).'&Body='. urlencode('This is my test message');


$res = curl_init();
curl_setopt( $res, CURLOPT_URL, $uri );
curl_setopt( $res, CURLOPT_POST, 3 ); 
curl_setopt( $res, CURLOPT_POSTFIELDS, $fields );
curl_setopt( $res, CURLOPT_USERPWD, $auth ); 
curl_setopt( $res, CURLOPT_RETURNTRANSFER, true ); 
$result = curl_exec( $res );
return $result;

我的手机没有收到短信。

twilio 是否适用于印度手机号码?

【问题讨论】:

  • @Ramya.twillo 为印度手机号码工作。您已添加到 +91
  • 我在我的号码上添加了 +91
  • @Ramya.you 可以检查 Gowri 的答案,因为我也有同样的想法。如果您的 Twilio 帐户处于跟踪模式,那么您将不会收到短信

标签: php twilio-php


【解决方案1】:

你的脚本是正确的。是的,Twilio 适用于印度数字。

您的 Twilio 帐户是否处于跟踪模式。如果它处于跟踪模式,则不会为未注册(已验证)的手机号码发送短信。您必须在 twilio 服务中注册您的手机号码。

从 twilio 控制台验证您的测试手机号码。

使用此网址https://www.twilio.com/console/phone-numbers/verified 验证您的手机号码。

经过验证的手机号码将收到短信。

【讨论】:

  • 谢谢,它工作正常我在验证 'to' 号码后收到了短信。
猜你喜欢
  • 2019-11-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多