Call: 01244 573240   Support: 0845 0093182
Follow Us:
Sign Up Free
Full Access - Free Credits
Takes 60 Seconds

Our price promise

We will match or beat any similar price offer.

Find out more

Our Latest Reviews

View all

View our Tutorials

See our latest Messenger video tutorials for help and advice on how to get started

Watch Now

Success stories

Testimonials from clients in your sector

View Testimonials

Developer API: Receive SMS Texts Online

Instantly forward SMS text messages to your application

You can configure any of your Textlocal inboxes to send a notification to a URL whenever you receive a message; this is perfect for two-way communication via your website or application. To enable message notifications, simply enter your URL into the inbox settings within Messenger.

Overview

Once you've configured your Textlocal inbox settings to forward to your URL, the following variables will be sent as POST variables:

sender The sender's mobile phone number in international format. For example, UK numbers will be formatted as 447123456789.
keyword If applicable, the keyword of the inbox.
content The full message content.
comments If applicable, the message without the inbox keyword.
inNumber The inbound number the message was sent to.
email Any email address extracted from the message.
credits The number of SMS credits remaining in your Textlocal account.
refid Unique reference for the message received.

Code Examples

As all we are doing is sending you variables, it's quite difficult to show code examples, however the following might help - including, in some languages, examples of writing the variables to a database and/or file:

					        $inNumber = $_REQUEST["inNumber"];
					        $sender = $_REQUEST["sender"];
					        $keyword = $_REQUEST["keyword"];
					        $content = $_REQUEST["content"];
					        $email = $_REQUEST["email"];
					        $credits = $_REQUEST["credits"];
					        $refid = $REQUEST["refid"];
					        
					        // Example: Writing to a file //
					        // File format: id, sender, content //
					        $fp = fopen('data.csv', 'a');
					        fwrite($fp, $refid.", ".$sender.", ".$content."\r\n");
					        fclose($fp);
					        
					        // Example: Writing to a database //
					        $mysqlic = new mysqli("localhost", $database_username, $database_password, $database_name);
					        If (mysqli_connect_error()) { die('Connect Error: '.mysqli_connect_errno().' - '.mysqli_connect_error()); };
					        $sql = "INSERT INTO inbound_contact (refid, sender, message) ";
					        $sql .= "VALUES ('".mysql_real_escape_string($refid)."', ";
					        $sql .= "'".mysql_real_escape_string($sender)."', ";
					        $sql .= "'".mysql_real_escape_string($content)."')";
					        $mysqlic->query($sql);
					        
					        

Create Your Free Account - 60 Second Signup - Free Expert Support

"Txtlocal was the cheapest txt service that I could find and the service is great. All of my messages get delivered quickly and I love that the credits never expire. I wish that the text reply service messages displayed your name to reply to so i give txtlocal 9.5/10 !!" - Tccvaleting

Read more reviews >

Our website uses cookies, mmm.... These are small files that make our website work better. If you're unhappy with this you will need to change your cookie settings.
Click here to view our privacy policy Or Click the x button to close.