Creating a PHP quiz game
The Ozeki Message Server contains an HTTP Client Plugin, that can be used to develop autoresponding SMS services, such as a Quiz game. To understand how this service works, take a look at (Figure 1.). In this setup the Ozeki message server, has an HTTP Client plugin configured, that acts as an HTTP - SMS gateway.
Ozeki Message Server runs as service on a Windows server. It communicates with the phone attached to this server with a phone-to-PC data cable or directly with a GSM service provider's SMSC using an IP SMS connection. Ozeki Message Server collects the SMS messages that arrive on the connection and passes them to your web application using an HTTP request. Your web application gets the sender phone number and the message text in the parameters of the HTTP request, and can generate the HTTP response, containing response SMS messages.
RECEIVING SMS MESSAGES AND SENDING A REPLY
If you are a web developer, you know, that web applications communicate with the user, using HTML forms. When a user wants to send information to the server, he fills out a form. In this case Ozeki Message Server does the same. It fills out a form automatically every time an SMS message is received. In other words it generates an HTTP GET or an HTTP POST request whenever an incoming message arrives. To pass this incoming message to your application the following URL is invoked, it the HTTP Client Plugin is configured:
http://www.yourserver.com/smsproc.php?sender=0620522245&receiver=06203105366&message=hello+world
The receiving web application (smsproc.php) can return a response SMS message by creating the following output.
{GSMSMS}{}{}{+36205552245}{Thank you for the message} |
Note, that this output cannot contain any line-breaks!
Using this technology we can create a simple Quiz game that works the following way: If the user sends in "September", the game responds in an SMS by saying "Correct", if any other text comes in it responds: "The answer is incorrect, please try again.". Here is the source code in PHP language of this application:
PHP EXAMPLE
http://www.yourserver.com/smsproc.php
<?php /* Write the log */ /* do some processing here */ if ($message='September') { } else { |