我在twilio中使用rest api创建了一个频道,接下来我尝试向其中添加成员,但失败了。这是我的代码
require('Services/Twilio.php');
// Find your Account Sid and Token at twilio.com/user/account
$sid = "ACCOUNT_SID";
$token = "AUTH_TOKEN";
// Initialize the client
$client = new IPMessaging_Services_Twilio($sid, $token);
// Retrieve the service
$service = $client->services->get("SERVICE_SID");
// Retrieve the channel
$channel = $service->channels->get("CHANNEL_ID");
// Add the member
$member = $channel->members.create(array(
"identity" => "JOHN",
));
print $member;
我收到错误:
致命错误:调用中未定义的函数create() twilio/sendsms.php 上线 101
如果我把它改成
$member = $channel->members->create(array(
"identity" => "JOHN",
));
错误:未捕获异常“Services_Twilio_RestException” 消息“帖子正文中缺少必需的参数身份” twilio/twilio-php-master/服务/Twilio.php:297
请向我通报这方面的最新情况。
您应该使用第一个大写字母的密钥“Identity”
$member = $channel->members->create(数组( “身份”=>“约翰”,));