Retrieving Twilio Programmable Messaging MMS Media Files

In all of Twilio’s Helper Library SDKs, we include a convenient method for retrieving media files. However, we know that some of our customers prefer to design their applications without the use of Twilio’s Helper Libraries.

If you are using PHP for your application code, please avoid the use of PHP’s file_get_contents method for retrieving media from Twilio Media URLs. Twilio's Media URLs may redirect to a destination URL that is too long for this method to handle (over 1,024 characters), resulting in an error.

Instead, please either use Twilio’s built-in “fetch” method for media in our PHP helper library (which uses PHP Curl behind the scenes), or use PHP Curl in your own code.

For a code sample of retrieving media using the “fetch” method, see Programmable SMS: Fetch a Media resource (Twilio Docs).

Have more questions? Submit a request
Powered by Zendesk