我正在使用此示例代码将数字从一个子帐户转移到另一个子帐户。 (https://www.twilio.com/docs/api/rest/subaccounts)
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACmastersid";
$token = "mastertoken";
$client = new Services_Twilio($sid, $token);
// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client->account->incoming_phone_numbers- >get("PN2xxxxxxxxxxxxxxxx");
$number->update(array(
"AccountSid" => "AC00000000000000000000000000000002"
));
echo $number->phone_number;
我收到此错误:
未找到所请求的资源/2010-04-01/Accounts/ACxxxxxxxx/IncomingPhoneNumbers/PNxxxxxxxxxxx.json
目前尚不清楚代码的问题是什么。
感谢任何帮助。
感谢。
答案 0 :(得分:1)
以下代码正常。您需要从要移动的帐户中获取电话号码对象,然后更新帐户sid。
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACmastersid";
$token = "mastertoken";
$client = new Services_Twilio($sid, $token);
$account = $client->accounts->get( "AC00000000000000000000000000000001");
$number = $account->incoming_phone_numbers->get($phonesid);
$number->update(array(
"AccountSid" => "AC00000000000000000000000000000002"));
echo $number->phone_number;