我在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-主/服务/ Twilio.php:297
请在这方面给我更新。
答案 0 :(得分:0)
你应该使用密钥'身份'
上的第一个大写字母$ member = $ channel-> members-> create(array( "身份" => " JOHN",));