最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

twilio php 发送短信,php

运维笔记admin101浏览0评论

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;

}

我如何捕获该回复?

发布评论

评论列表(0)

  1. 暂无评论