Twilio API文檔非常全面,並提供瞭如何進行大部分調用的示例。他們還提供了一個SDK庫,使其更容易。我相信您要查找的電話是/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers
(Twilio Documentation)。有一個在該頁面調用它的一個例子:
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACdc5f132a3c49700934481addd5ce1659";
$token = "{{ auth_token }}";
$client = new Services_Twilio($sid, $token);
// Loop over the list of numbers and echo a property for each one
foreach ($client->account->incoming_phone_numbers as $number) {
echo $number->phone_number;
}
您將需要獲得「twilio-PHP」庫,它也可以在他們的網站,或here發現。