2
我正在使用Twilio PHP SDK。我有一個電話號碼的sid。我如何刪除它?如何用Twilio PHP SDK刪除電話號碼?
其餘的API文檔顯示了刪除方法,但沒有它的代碼。
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#list
我已經看到了堆棧溢出一些例子,但他們似乎都使用SDK的舊版本。
我正在使用Twilio PHP SDK。我有一個電話號碼的sid。我如何刪除它?如何用Twilio PHP SDK刪除電話號碼?
其餘的API文檔顯示了刪除方法,但沒有它的代碼。
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#list
我已經看到了堆棧溢出一些例子,但他們似乎都使用SDK的舊版本。
示例代碼delete()
一個Twilio電話號碼:
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);
// Delete a Twilio number based on its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client
->incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
->delete();
警告:Once the number is deleted, any code using it, won't work. Be sure you really want to run the code above.
完美。謝謝! –
這是什麼PN2a0747eba6abf96b7e3c3ff0b4530f6e?是個人號碼,我怎麼能從twillo號碼得到sid? –