twilio php 发送短信,php

twilio php 发送短信,php

我正在尝试使用Twilio发送一些SMS消息,到目前为止,这很简单,但是我正在使用一些测试数据来捕获各种情况,并且我使用“ 1234567890”作为电话号码来捕获错误,但是导航到查询twilio api的页面时,出现以下错误:Fatal error: Uncaught exception 'Twilio\Exceptions\RestException'

with message '[HTTP 404] Unable to fetch record:

The requested resource /PhoneNumbers/1234567890 was not found'

这是我的代码:use Twilio\Rest\Client;

$client = new Client($sid, $token);

if($ph && preg_match('/^[0-9]{10}$/', $ph)) {

//this returns an array containing type, error_code, and a boolean

//value for is_valid.

$response = lookup($client, $ph);

if($response['is_valid']) {

//send the message via twilio.

$message = $client->messages->create(

$ph,

array(

'from' => 'my_twilio_number_goes_here',

'body' => 'text_body_goes_here'

)

);

//handle twilio response

$status = $message->status;

$sid = $message->sid;

}

我如何捕获该回复?

发布者:admin,转转请注明出处:http://www.yc00.com/news/1692810569a645133.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信