Receiving SMS for SMPP link and put the message in table

Receiving SMS for SMPP link and put the message in table SearchSearch
Author Message
Korek tech
New member
Username: Tech

Post Number: 1
Registered: 08-2011
Posted on Monday, August 01, 2011 - 09:09 am:   

Dears ,

My question is how can I receiving the messages over SMPP connection and save the records in table .


Best Regards
Tech}}
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3370
Registered: 08-2008
Posted on Monday, August 01, 2011 - 02:56 pm:   

Hi,

I'll assume you have some experience with web development (otherwise I wouldn't know where to start).

If you can process data from a web page form, that's basically the same procedure you use to process a received SMS.

If you think about a web form, the form has a target script/URL that receives the form parameters that the user supplied. Each field in your form is a passed to your script via a field name parameter.

In NowSMS, you define a 2-way command, which is a URL that processes each received message. http://www.nowsms.com/doc/2-way-sms-support

It might be easier to think of a NowSMS 2-way command as something that converts the received text message into a form that is posted to your script.

For simplicity, NowSMS uses a form method of "GET" instead of "POST".

Let's say you have a 2-way command configured to call http://server/2way.php?sender=@@SENDER@@&text=@@FULLSMS@@

NowSMS is taking the received text message and converting it to a form to be posted to your script. The sender address of the text message is in the "sender" variable, and the text of the message is in the "text" variable.

Here's an example of what 2way.php could look like as a PHP script:


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

if (isset($_REQUEST['sender'])) {
if (isset($_REQUEST['text'])) {
echo "I recieved your message : " . $_REQUEST['text'];
}
else {
echo "ERROR : 'text' parameter missing\r\n";
}
}
else {
echo "ERROR : 'sender' parameter missing!\r\n";
}

?>

If you wanted to store the data to a database, you would take the values of $_REQUEST['sender'] and $_REQUEST['text'] and add code to the script to put these values into a database.

If you wanted to look for certain values in the text, then you could get more sophisticated in your script.

This example assumes that the 2-way script is configured in NowSMS with the option "Command returns response text". This means that NowSMS looks for whatever text you echo back and sends it as a response. Uncheck that option if you do not wish to send a response.

--
Des
NowSMS Support
Korek tech
New member
Username: Tech

Post Number: 2
Registered: 08-2011
Posted on Tuesday, August 02, 2011 - 09:55 am:   

Hi Des

Thanks for you support .


BR//