Send Outbound MMS - Technical

In order to send an MMS file out across all UK networks we will need an SMIL file of less than 100kb as this is currently the maximum size supported by all networks.

As such, for the time being Outbound MMS is best for sending pictures, sounds and words as 100kb is plenty for this. However, for video files this equates to roughly 12 seconds – so these will need to be quite short.

We can work with you to craete your MMS campaign, or you can use MMS API gateway.

MMS API Gateway

Send MMS picture messages, video and audio directly from your own applications with our simple interface.

Programming Code

The HTTP POST API

HTTP POST can be used in all modern programming languages including ASP, ASP.NET, c++, c#, php, VB, VB.NET, command lines, SSH & cURL. The following section outlines how to send messages using either php or ASP. We can provide examples in other languages on request, simply Contact Us at support@txtlocal.com.

Meet the 7 simple variables

address

The url on the Txtlocal server where we receive your messages. This is static and can not be changed. Always use: www.txtlocal.com/sendmmspost.php - preferably using HTTP(s) for your own security.

url

The URL of the MMS ZIP file on your server. An example of an MMS ZIP file can be found at http://www.txtlocal.co.uk/zips/sweetdreams.zip & http://www.txtlocal.co.uk/zips/xmas6.zip

from

The "From Address" that is displayed when the message arrives on handset. Must be pure numeric. Min 3 chars, max 12 pure numeric chars.

uname

Your txtlocal.com username

pword

Your txtlocal.com password

number

An international mobile number. The number must be PURELY numeric, no + symbols or hyphens or spaces. The numbers must start with the international prefix. In UK this would be 447xxxxxxxxx. For more prefixes click here.

subject

The MMS subject. Must be < 20 characters

*We return error codes if any of the above bounds fail. We return "Success: number" if the MMS send is good. We also return "Credits: number" to let you know how many MMS credit remain on your account.

Send Using PHP

<?php
//set up variables
$address = "www.txtlocal.com/sendmmspost.php";
$url = "http://www.txtlocal.co.uk/zips/sweetdreams.zip";
$subject = "My Subject";
$subject = urlencode($subject); //encode special characters (e.g. £,& etc)
$from = "07786200350";
$uname = "youremailaddress";
$pword = "yourpassword";
$number = "447740101097";

//build url
$data = "uname=" . $uname . "&pword=" . $pword . "&url=" . $url . "&from=" . $from . "&number=" . $number . "&subject=" . $subject;

//send messages
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://$address");
//curl_setopt($ch, CURLOPT_URL,"https://$address"); //secure connection
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //use this to suppress output
$result = curl_exec ($ch);
curl_close ($ch);
?>


Send Using ASP

<%
subject = "My Subject"
subject = Server.urlencode(subject) 'encode special characters (e.g. £,& etc)
from = "07786200350";
uname = "youremailaddress";
pword = "yourpassword";
number = "447740101097";
url = "http://www.txtlocal.co.uk/zips/sweetdreams.zip";

url = address & "?uname=" & uname & "&pword=" & pword & "&url=" & url & "&from=" & from & "&number=" & number & "&subject=" & subject

set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.send ""
msg = xmlhttp.responseText
response.write(msg)
set xmlhttp = nothing
%>

Send Using .NET

<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<script language="C#" runat="server">

void Page_Load(Object Src, EventArgs E) {
myPage.Text = readHtmlPage("http://www.txtlocal.co.uk/sendmmspost.php");
}
private String readHtmlPage(string url)
{
String result = "";
String strPost =
"uname=youremail@domain.com&pword=yourpass" +
"&url=http://www.txtlocal.co.uk/zips/sweetdreams.zip&from=07786200350" +
"&number=447740101097&subject=mysubject";
StreamWriter myWriter = null;
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
try{
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(strPost);
}
catch (Exception e)
{
return e.Message;
}
finally {
myWriter.Close();
}

HttpWebResponse objResponse =
(HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()) )
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return result;
}
</script>