2

I am using Twilio API on my php project, I am able to retrieve caller's information like Country Code etc. But I am not able to find something which can also provide its City/State info, here is the API I am using:

<?php
    require 'Twilio/autoload.php';
    use Twilio\Rest\Client;

    // Your Account Sid and Auth Token from twilio.com/user/account
    $accountSid = "<ACCOUNT SID>";
    $authToken = "ACCOUNT TOKEN";
    $client = new Client($accountSid, $authToken);

    $number = $client->lookups->phoneNumbers("<PHONE NUMBER>")->fetch();

    echo "<pre>";
    print_r($number);
    echo "</pre>";
?>

Here is the response I get:

[properties:protected] => Array
        (
            [callerName] => 
            [countryCode] => US
            [phoneNumber] => <PHONE NUMBER>
            [nationalFormat] => <PHONE NUMBER>
            [carrier] => 
            [addOns] => 
            [url] => https://lookups.twilio.com/v1/PhoneNumbers/<PHONE NUMBER>
        )
halfer
  • 19,824
  • 17
  • 99
  • 186
Amrinder Singh
  • 5,300
  • 12
  • 46
  • 88

1 Answers1

2

Twilio developer evangelist here.

You can't get address details from the basic, carrier or caller name Lookups API.

However, the Twilio Add-ons marketplace makes it easy to use third party services to find that information. You could add the White Pages Pro Caller Identification or the Next Caller Advanced Caller ID add-ons and get in depth address information.

philnash
  • 70,667
  • 10
  • 60
  • 88