I try to validate a phone number and test carrier value.
How to set a loop using PHP and response in the case of false carrier?
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require "vendor/autoload.php";
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "{{account_sid}}"; $token = "{{auth_token}}"; $client = new Lookups_Services_Twilio($sid, $token);
// Perform a carrier Lookup using a US country code
$number = $client->phone_numbers->get("+1XXX", array("CountryCode" => "US", "Type" => "carrier"));
// Log the carrier type and name
echo $number->carrier->type . "\r\n";
// => mobile
echo $number->carrier->name; // => Verizon ```
?>
How to store into variable. Just an an example of phone number: +1 866 XXX XXX
carrier->type
carrier->name
Twilio Lookup allows you to get information about phone numbers programmatically. This information can include the name of the phone number’s carrier, their type (landline, mobile, VoIP, etc.), the name of the caller
A phonebook REST API that you can use to check whether a number exists, format international numbers to local standards, determine whether a phone can receive text messages, and even discover information about the carrier associated with that phone number.
So, I like to information about the carrier associated with that phone number.