Http scripts

Http scripts SearchSearch
Author Message
Bert Schreuders
New member
Username: Berts

Post Number: 1
Registered: 04-2004
Posted on Friday, April 02, 2004 - 02:26 pm:   

Hi All,

Do you know some links or tips for http scripts to process received SMS's.

Thanks in advance,

Bert
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2257
Registered: 10-2002
Posted on Friday, April 02, 2004 - 03:23 pm:   

Hi Bert,

I probably should write up some simple examples. But most of what you would do in the script would be application specific.

So let me offer a real simple example.

Suppose you configure a "2-way" command of http://your.server/receivesms.php?sender=@@SENDER@@&msgtext=@@FULLSMS@@

Every time NowSMS receives a message, it will call your configured command, substituting the phone number of the sender for the @@SENDER@@ placeholder, and the text of the SMS message for the @@FULLSMS@@ place holder.

A simple implementation of receivesms.php would look like this:

<?php

$sender = $_GET['sender'];
$msgtext = $_GET['msgtext'];

header("Content-Type: text/plain");

print ("Hello $sender, thank you for your message\r\n");

?>

This example simply parses the command parameters, and sends a simple reply back that includes the sender's phone number.

Even if you're not familiar with PHP, the concept is the same in other scripting languages.

You want to parse the parameters that are passed to the script, and you want to process that information in a manner specific to your application.

To respond back with a simple text message, you can check "Command returns response text" when defining the command in the "2-way command table" ... and then make sure that your script responds back with content of the type "text/plain".

Or, you can use a redirect response to send a command back to the NowSMS gateway to tell it to take some action. (e.g., send back a redirect response that includes a URL that would be used to tell NowSMS to send some content)

Maybe this example will help you get started. For more information, also refer to:

http://www.nowsms.com/documentation/ProductDocumentation/2_way_sms_support.htm
http://www.nowsms.com/support/bulletins/tb-nowsms-003.htm

-bn