0

在他们的示例中https://www.twilio.com/user/account/phone-numbers/search我可以看到“本地”电话号码位置 - 城市/州。但是 $numbers 变量不包含有关城市的任何信息。有没有办法像在 url 中一样获取它?

$numbers = $client->account->available_phone_numbers->getList('US', 'Local', array(
        "InRegion" => "AR"
    ));

数据:

object(sfOutputEscaperObjectDecorator)[319]
  protected 'value' => 
    object(stdClass)[244]
      public 'friendly_name' => string '(646) 681-4092' (length=14)
      public 'phone_number' => string '+16466814092' (length=12)
      public 'lata' => string '132' (length=3)
      public 'rate_center' => string 'NWYRCYZN01' (length=10)
      public 'latitude' => string '40.714300' (length=9)
      public 'longitude' => string '-74.006000' (length=10)
      public 'region' => string 'NY' (length=2)
      public 'postal_code' => string '10000' (length=5)
      public 'iso_country' => string 'US' (length=2)
      public 'address_requirements' => string 'none' (length=4)
      public 'beta' => boolean false
      public 'capabilities' => 
        object(stdClass)[245]
          public 'voice' => boolean true
          public 'SMS' => boolean true
          public 'MMS' => boolean true
  protected 'escapingMethod' => string 'esc_specialchars' (length=16)
4

1 回答 1

0

Twilio 开发人员布道者在这里。

该文档显示了您返回的有关数字资源的数据。对于不同的国家,它可能会有所不同,这里是美国和加拿大的数字属性,您可以在下面找到其他国家的数字属性。

我相信,在测试了几个号码之后,电话号码搜索页面中显示的城市实际上是rate_center房产。

如果您需要更准确,您可以考虑根据从 API 返回的纬度和经度对数字进行反向地理定位,并从中获取城市。或者根据邮政编码进行地址查找。

于 2015-11-05T13:02:20.230 回答