Twilio cURL request returns just a string of information Twilio cURL request returns just a string of information curl curl

Twilio cURL request returns just a string of information


It is a lot easier if you use the PHP helper library. It woudl look something like this:

// Your Account Sid and Auth Token from twilio.com/user/account$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";$token = "{{ auth_token }}";$client = new Services_Twilio($sid, $token);$numbers_arr = array();// Loop over the list of numbers and echo a property for each oneforeach ($client->account->incoming_phone_numbers as $number) {    $numbers_arr[] = $number->phone_number;}return json_encode($numbers_arr);

}

This function uses the Twilio PHP SDK to get a list of all numbers in the account then puts them into an array variable $numbers_arr and returns that variable as JSON.