如何使用PHP库获取可以购买twilio号码的国家/地区

如何使用PHP库获取可以购买twilio号码的国家/地区,twilio,twilio-php,Twilio,Twilio Php,Twilio文档提供了一个搜索美国本地号码的示例 $client = new Services_Twilio($sid, $token); $numbers = $client->account->available_phone_numbers->getList('US', 'Local', array( "InRegion" => "AR" )); foreach($numbers->available_phone_numbers as $number)

Twilio文档提供了一个搜索美国本地号码的示例

$client = new Services_Twilio($sid, $token);
$numbers = $client->account->available_phone_numbers->getList('US', 'Local', array(
    "InRegion" => "AR"
));
foreach($numbers->available_phone_numbers as $number) {
    echo $number->phone_number;
}
有没有办法让我找到所有有twilio号码的国家?所以我可以在其中一个国家搜索号码。
谢谢

我设法得到了twilio号码可用的国家名单

public function getAvailableCountries(){

    $client = new \Services_Twilio($this->sid, $this->token);

    $uri = '/'. $client->getVersion() . '/Accounts/' . $this->sid . '/AvailablePhoneNumbers.json';

    try{
        $numbers = $client->retrieveData($uri);

        //returns an array of countries where twilio numbers are supported
        return $numbers->countries;

    }catch(Exception $e){
        return $e->getMessage();
    }
}

我设法得到了有twilio号码的国家名单

public function getAvailableCountries(){

    $client = new \Services_Twilio($this->sid, $this->token);

    $uri = '/'. $client->getVersion() . '/Accounts/' . $this->sid . '/AvailablePhoneNumbers.json';

    try{
        $numbers = $client->retrieveData($uri);

        //returns an array of countries where twilio numbers are supported
        return $numbers->countries;

    }catch(Exception $e){
        return $e->getMessage();
    }
}
列出提供语音服务的国家/地区


列出提供消息服务的国家/地区


列出具有Twilio编号的国家/地区

列出提供语音服务的国家/地区


列出提供消息服务的国家/地区


列出具有Twilio编号的国家/地区

// 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 = "AC324da90614bccf7f52759757713463c0";
$token = "your_auth_token";

$client = new Client($sid, $token);

$messagingCountries = $client->pricing->messaging->countries->stream();

foreach ($messagingCountries as $c) {
    echo $c->isoCountry;
}
// 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 = "AC324da90614bccf7f52759757713463c0";
$token = "your_auth_token";

$client = new Client($sid, $token);

$phoneNumberCountries = $client->pricing->phoneNumbers->countries->read();

foreach ($phoneNumberCountries as $c) {
    echo $c->isoCountry . PHP_EOL;
}