Call PHP Scripts

Call PHP Scripts SearchSearch
Author Message
sengleng
New member
Username: Sengleng

Post Number: 1
Registered: 04-2009
Posted on Monday, April 13, 2009 - 10:27 am:   

HI all,

First of all, I am newbie in NOWSMS, thanks for yours HELP.

1. I would like to call a PHP script when the gateway receive a SMS, what should I do?

2. How can i reveive the PHP script from web application to perform the following actions: send reply SMS, send bulk SMS....

Thanks & Regards,
SengLeng
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 7765
Registered: 10-2002
Posted on Monday, April 13, 2009 - 07:25 pm:   

Hi,

The PHP script runs on a standard web server. In NowSMS, you configure a "2-way" command that connects to the HTTP URL of the PHP script on that web server.

Here are some good links that include a simple example:

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

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

-bn
sengleng
New member
Username: Sengleng

Post Number: 2
Registered: 04-2009
Posted on Tuesday, April 14, 2009 - 05:25 am:   

Do you have any diagrams or pictures to illustrate more details ?

Thanks a lot !
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 7766
Registered: 10-2002
Posted on Wednesday, April 15, 2009 - 01:40 pm:   

Sorry, I don't really have any pictures or diagrams.

The basic concepts to keep in mind are this:

When NowSMS receives an SMS messages from one of its SMSC connections (GSM modem, SMPP, etc.), it evaluates the command list on the "2-way" page to see if it should pass the received message to a custom 2-way command.

These 2-way commands can be either a local command line program (such as a VBScript or JScript command for the Windows script host), or it can be an HTTP URL. If you use an HTTP URL, that URL can point to any type of script supported by your web server (PHP, Perl, Java).

Details of the received message are passed as URL parameters, and the script examples in the above links are pretty good at explaining that.

Replying back is easy, because you just include a text response in your script that specifies what you want to send in reply. The example here shows this: http://support.nowsms.com/discus/messages/1/3991.html

It gets more difficult if you want if you want to do something more advanced, such as sending a new bulk SMS in reaction to a received SMS.

When you're using PHP, the easiest way to do this latter case is to have your PHP script generate a new HTTP request back to the NowSMS server to send whatever messages you want to send.

Admittedly, that scenario is a bit confusing ... but NowSMS initiates an HTTP connection to the other web server to run your PHP script. While that PHP script is running, it can initiate a new HTTP connection back to the NowSMS server to send one or more messages. There's a PHP script that shows how to send SMS messages here: http://blog.nowsms.com/2008/10/nowsms-php-example-send-sms-text.html

-bn