DEPRECATED - Send Text Messages via our SMS API Gateway

Create your account, paste the code, send texts - simple!

Choose an API

Thousands of clients connect to our SMS gateway every day - from organisations sending millions of texts to hobbyists sending just 1 - its very easy, low cost, secure and reliable and you will be amazed how quickly you integrate.

Please note: You can send unique content to multiple numbers in one API call with the XML API.

				    // Configuration variables
				    $info = "1";
				    $test = "0";
				    // Data for text message
				    $uname = '';
				    $pword = 'yourpassword';
				    $from = "Jims Autos";
				    $selectednums = "447XXX XXXXXX";
				    $message = "Test with an ampersand (&) and a £5 note";
				    $message = urlencode($message);
				    // Prepare data for POST request
				    $data = "uname=".$uname."&pword=".$pword."&message=".$message
				    ."&from=". $from."&selectednums=".$selectednums."&info=".$info."&test=".$test; 
				    // Send the POST request with cURL
				    $ch = curl_init(''); //note https for SSL
				    curl_setopt($ch, CURLOPT_POST, true);
				    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
				    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
				    $result = curl_exec($ch); //This is the result from Textlocal

API Parameter Details

The following is a list of variables that can be defined: (* indicates optional)

uname Your Textlocal username (login email address. Sign up for a free test account)
pword * Your Textlocal password. * Either pword or hash is required.
apikey * This can be used instead of the uname and pword. Generating an apiKey can be done from within your Messenger Control Panel.
info * Set to '1' to receive information about the request back to your application.
json * Set to '1' to receive a JSON structured response about your request back to your application. The variable info must be set to 0 to receive JSON.
hash * Your Textlocal hash (instead of password above). You can retrieve this from the Messenger->Documentation-All page. * Either pword or hash is required.
from The Sender Name. This can be a word (up to 11 characters) or a number (up to 14 digits). If you set to 'xreplyx' then we will allocate a reply path number to the message, and any replies will arrive in your Simple Reply Service inbox within Messenger. You can then choose to forward these replies to email or your webserver via the Simple Reply Service settings page.
message The text message body. This parameter will need to be URI-encoded.
selectednums A comma-delimited list of mobile numbers in international format. Each number must be purely numeric, so no '+' symbols, hyphens or spaces.
The numbers must be prefixed with their international dialling codes. For example, United Kingdom numbers would look like 447XXX XXXXXX.
group * Contact group ID. If set, you can send your message to an entire Textlocal contact group. You can view a full list of group IDs in the Reports section of Messenger.
custom * If set, this value will be recorded against the message batch and will passed back in the delivery receipts. This allows you to match delivery receipts to their corresponding messages.
rcpurl * Receipt notification URL. If set, all delivery receipts for this message will be sent to the specified URL, instead of the one specified in your Textlocal Account Settings.
sched * Message schedule time. If set, the message will be sent at the specified date and time. This parameter needs to be in the format YYYY-MM-DD-HH-MM-SS (e.g. 2012-01-20-11-30-00 for 11:30am on the 20th January 2012). Scheduled messages can be viewed, modified and deleted via the Messenger.
validity * Message validity datetime. If set, this is the GMT time at which you wish the message to expire if has not yet been received by the phone. This parameter needs to be in the format MMDDHHmm and cannot be more than 48 hours into the future.
test * Sets 'test mode'. Messages will not actually be transmitted, but will appear in the Reports->API Test area of messenger.

Debugging/Error Information

You can get two types of response from our Send SMS API - generic text or JSON. The following table shows the different outputs and responses accordingly.

Info (generic text)

TestMode 0 for live, 1 for testing
MessageReceived The received message
ScheduledDate The received scheduled SMS time
Custom The received custom ID to be passed back in receipt
From The FROM address used. If an invalid address has been passed (say, alphanumeric > 11 characters), it will default to the main account default address.
CreditsAvailable Number of credits at start
MessageLength Length of the message in characters
MessageCount Number of messages (break at 160, 306, 459, 612)
NumberContacts The number of comma separated numbers
CreditsRequired Credits required for job
CreditsRemaining Credits remaining after the job


Invalid Login Incorrect username and password/hash
Invalid IP If defined, you are coming from the wrong IP address
Invalid validity datetime (MMDDHHmm) Validity time incorrectly formatted
Message Expired Validity time is in the past
No content Message Length zero
Invalid scheduled date format Validity time incorrectly formatted
No mobile number(s) No numbers defined
Message Too Long (<765 characters) Message too long
No credit No SMS credits
Not enough credit Not enough credits for message
testmode - nothing sent You entered test=1, therefore nothing has been sent, however the format of the request you sent was valid


Below is an example JSON response. If there is an error, Error will exist, and the text will be as above.

					TestMode: 0,
					MessageReceived: "This is a test message",
					MessageCount: 1,
					From: "Textlocal:default",
					CreditsAvailable: 134,
					MessageLength: 5,
					NumberContacts: 1,
					CreditsRequired: 1,
					CreditsRemaining: 133
Scroll for more