Omega
Omega

Reputation: 133

How to get Twilio Recording file in PHP

I am using Twilio application. I want to get the path of my recording. I am using this code:

$client = new Services_Twilio($sid, $token, $version);

$calls = $client->account->calls->getIterator(0, 50, array(      
)); 

$url = $call->subresource_uris->recordings;

in the variable $url /2010-04-01/Accounts/<acount id>/Calls/callerid/Recordings.json

But when i paste this url "https://api.twilio.com/2010-04-01/Accounts/<acount id>/Calls/callerid/Recordings.json" it gives me alert popup to enter user name and password.

Basically i want this file to save on my system

Upvotes: 0

Views: 2249

Answers (1)

Devin Rader
Devin Rader

Reputation: 10366

Twilio evangelist here.

The URL you are using is requesting a list of Recording resources from Twililo, not the actual audio files. Each resource contains a property called Url that represents that actual audio recording file.

If you want to download the audio, you will need to loop through that list of recordings and make a new HTTP GET request to the Url specified in the Url property.

Hope that helps.

Upvotes: 2

Related Questions