Twilio '$client->account->sms_messages->create()' 不起作用,只是加载页面


$to=+11111111;   
$body="hello Its not working";  
    $AccountSid = "*********************************";
    $AuthToken = "*********************************";
    $client = new Services_Twilio($AccountSid, $AuthToken);
    $from = '+11111111';
    $message =     $client->account->sms_messages->create($from, $to, $body);
    return true;

它在普通服务器上工作,但在亚马逊服务器上不工作。当我$message注释时,代码会正确加载页面,而取消注释$message时,它只是继续加载(即加载圈继续滚动而不打开任何页面)。我也收到了数字和短信,这不是问题,但$client->account->sms_messages->create()不起作用。

有人帮忙!

如果你给出"+11111111111"作为数字。Twilio 将显示错误

Fatal error: Uncaught exception 'Services_Twilio_RestException' with message 'The 'From' number 11111111111 is not a valid phone number or shortcode.

因此,您应该添加有效的 twilio 号码,这些号码存在于您的 twilio 帐户中,作为起始号码。然后试试这个。

$sms = $client->account->messages->create(array( 
        'To' => "$toNumber", 
        'From' => "$myNumber",
        'Body' => "$msg"));   
}

最新更新