Textlocal Logo

API Documentation

Receive MMS Images & Audio API

A UK only service You can configure any of your Textlocal MMS inboxes to send a notification to a URL whenever you receive an MMS. To enable message notifications, simply enter your URL into the inbox settings within Messenger.

Example Handler On Your Webserver

<?php
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
$body = $_REQUEST['body'];
$subject = $_REQUEST['subject'];
$files = explode(',', $_REQUEST['files']);
if(sizeof($files) > 0)
{
	// Loop through files
	foreach($files as $file)
	{
		// Get file name
		$filename = basename($file);

		// Download file
		$ch = curl_init($file);
		$fp = fopen('images/'.$filename, 'wb');
		curl_setopt($ch, CURLOPT_FILE, $fp);
		curl_setopt($ch, CURLOPT_HEADER, 0);
		curl_exec($ch);
		curl_close($ch);
		fclose($fp);
	}
}
?>

Parameters

from The sender's mobile phone number in international format. For example, 077xx xxxxxx numbers will be formatted as UK.
subject The subject line of the MMS message. If you have a keyword on a shortcode, this field will be blank.
to The inbound number the message was sent to.
body The full message content.
files A comma-delimited list of URLs to the MMS media sent in the message. This will normally include a text file containing the message content.