运行脚本时出现此错误:
致命错误:未捕获的Twilio \ Exceptions \ RestException:[HTTP 451] 无法在中创建记录 D:\ xampp \ htdocs \ projects \ twilio_script \ vendor \ twilio \ sdk \ src \ Twilio \ Version.php:87 堆栈跟踪:#0 D:\ xampp \ htdocs \ projects \ twilio_script \ vendor \ twilio \ sdk \ src \ Twilio \ Version.php(219): Twilio \ Version-> exception(Object(Twilio \ Http \ Response),'无法 创造...')#1 D:\ xampp \ htdocs \ projects \ twilio_script \ vendor \ twilio \ sdk \ src \ Twilio \ Rest \ Api \ V2010 \ Account \ MessageList.php(66): Twilio \ Version-> create('POST','/ Accounts / ACdaf ...',Array,Array)#2 D:\ xampp \ htdocs \ projects \ twilio_script \ scirpt.php(18): Twilio \ Rest \ Api \ V2010 \ Account \ MessageList-> create('+ ******', 对象(Twilio \ Values))#3 {main}被抛出 D:\ xampp \ htdocs \ projects \ twilio_script \ vendor \ twilio \ sdk \ src \ Twilio \ Version.php 在第87行
这是我的代码:
<?php
require_once __DIR__.'/vendor/autoload.php';
use Twilio\Rest\Client;
$sid = "*********";
$token = "*********";
$twilio = new Client($sid, $token);
$twilio->messages->create("+*********", // to
array(
'from' => '+*********',
"body" => "test message",
)
);
?>