Incoming SMS API for PHP
We receive lot of inquiries from our users asking about how to receive incoming SMS to their application. I think our developers are expecting it to be very complicated than it is. We have made our incoming sms api extremely simple and user friendly.
Actually all you are doing is setting up a web page to which we send the incoming data to through an HTTP GET. Whatever your web page displays, is sent back to the phone.
In order to give our developers an open hand, we have also given an option to setup their web page URL on which they want to receive their incoming data. (Add/Edit keywords in control panel)
Here is a sample PHP script which you can put to your webpage.
<?php
$smssender = $_GET["who"];
$incomingMessage = $_GET["what"];
echo(“The sender is $smssender, the message is $incomingMessage .”);
// Here you can also echo a dynamic auto reply based on incoming message and sender.
?>
It doesn’t get simpler than that! Create a page with this in it on your web site called smshandler.php.
Go into our control panel an put the full URL in the URL Post box.
eg. http://yoursite.com/smshandler.php
When an incoming message to your keyword comes in, it will be sent to your URL as follows (with the real values) –
http://yoursite.com/smshandler.php?who=919898123456&what=Keyword
The variables we send to you on the query string are:
- who – phone # of the incoming sms
- what – the complete message
If you call the script in your browser with the query string, you should see the message returned.
Make sure there is NO HTML at all in the response.
Thats it! Now don’t wait .. just create an account for Long code and have a THREE days of FREE Trial on your favourite keyword .
Team SMSGATEWAYHUB