2 way sms query database

2 way sms query database SearchSearch

SMS & MMS Technical Forum » NowSMS Support - SMS Issues (Product Support Only) » Archive through May 20, 2013 » 2 way sms query database « Previous || Next »
Author Message
Boris Antoine
Posted on Sunday, January 20, 2013 - 01:08 am:   

Hi ,would like to have a 2 way sms with a mysql query.When the sender send numbers, want to see if it match with another field, if it is empty, reply "it's empty", if it not empty, reply "it's exist"
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4259
Registered: 08-2008
Posted on Monday, January 21, 2013 - 02:57 pm:   

Hi Boris,

It's easiest to think of it this way...

Could you write a script (PHP, ASP, or other web scripting language) that processed a web form where the user entered a number into the form and your script returned this exist or empty response?

When you define a 2-way command in NowSMS it essentially works the same way, it is like the text message is a web form being submitted to your script (2-way command).

A good starting point example in PHP can be found here:

http://support.nowsms.com/discus/messages/1/3991.html

It shows you how the data from the text message is passed to a PHP script. You would need to add logic to interface with your database.

--
Des
NowSMS Support
Boris Antoine
New member
Username: Mawogani

Post Number: 2
Registered: 06-2007
Posted on Wednesday, January 23, 2013 - 06:32 pm:   

Ok, I have 2 file on my server, search.html and search.php
in the html file, i have a text box and a submit button and the php file, it return the information, how can i implement in your program???where the text box is what the gsm user enter and want it to received back the answer.
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 8049
Registered: 10-2002
Posted on Thursday, January 24, 2013 - 06:46 pm:   

Hi Boris,

NowSMS is going to perform an HTTP GET form reqeust.

So what is the variable name in your form? I'll suppose it is named TEXT.


In NowSMS, configure a 2-way command of http://server/search.php?SENDER=@@SENDER@@&TEXT=@@FULLSMS@@

Define the SMS Command Prefix as * (meaning all inbound SMS will be routed here).

Check "Command Returns Response Text" (means that your PHP script will return a text response).

Here is a simple PHP script:

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

if (isset($_REQUEST['SENDER'])) {
if (isset($_REQUEST['TEXT'])) {
$text = $_REQUEST['TEXT'];
// Here you'd do your processing of the input text
// We just return a simple text response
echo "I recieved your message : " . $text;
}
else {
echo "ERROR : 'TEXT' parameter missing\r\n";
}
}
else {
echo "ERROR : 'SENDER' parameter missing!\r\n";
}

?>

$_REQUEST['SENDER'] and $_REQUEST['TEXT'] are how we parse the form request variables.

header ("Content-Type: text/plain") tells PHP we are returning a simple text response, and in this case we are using the PHP echo command to return it.

-bn

Bryce Norwood
Now SMS/MMS Support
Boris Antoine
New member
Username: Mawogani

Post Number: 3
Registered: 06-2007
Posted on Friday, January 25, 2013 - 01:30 pm:   

OK I get it, I test the script and got it, I'll buy a cheap modem to test it live, I'm planning to buy a Sierra Wireless AT&T USBConnect 881 3G GSM Modem, will it work?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4262
Registered: 08-2008
Posted on Monday, January 28, 2013 - 08:35 pm:   

Hi Boris,

Sierra Wireless modems generally work quite well, there is just a trick to get them configured initially because of the drivers.

The following link will explain and guide:

http://www.nowsms.com/sierra-wireless-881-usb-modem-881u-and-nowsms
http://www.nowsms.com/sms-and-mms-with-the-sierra-wireless-compass-885-usb-modem

--
Des
NowSMS Support

Login Login / Register Logout Logout Search Last 30 Days Topics Topics