I'm trying to work out how I can display the first returned value (phone number) only. At the moment this code returns ALL available numbers but I only want to display one to the customer.
Here's the code. I hope someone can help. I'm pretty new to this you see, I've tried a few bits but they haven't worked.
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('Services/Twilio.php'); // Loads the library
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC1f3ccf29618exxxxx";
$token = "{{Auth_Token}}";
$client = new Services_Twilio($sid, $token);
$numbers = $client->account->available_phone_numbers->getList('GB', 'Local', array(
"Contains" => "44161"
));
foreach($numbers->available_phone_numbers as $number) {
echo $number->phone_number;
}
?>
Currently I get a list as follows:
+441618503707+441618503748+441618502214+441618502601+441618502327+441618503631+441618503785+441618503437+441618503432+441618503758+441618503593+441618503404+441618503794+441618502289+441618503684+441618503519+441618503629+441618503810+441618503704+441618503742+441618503557+441618503302+441618503604+441618503539+441618503044+441618503298+441618503799+441618503753+441618503447+441618503801
I would just like to display the first value IE +441618503707
Help appreciated, I may not respond right away as this is one of many projects on at the moment. Rest assured though my other projects are on Infusionsoft, I don't dabble in API/PHP too often!