SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 194 | Next

Nirav Mehta

"Mobile Web Development"


2. To receive messages via HTTP, we must set up a callback URL with our API.
We set this up from our Clickatell Central account.
3. Our callback URL will point to receiveMessage.inc.php??”a new file we are
creating. In the file, we first validate incoming parameters from Clickatell.
Let's see how this bit looks in the file.
// Clickatell sends us following parameters
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
$timestamp = $_REQUEST['timestamp'];
$text = $_REQUEST['text'];
if ($from == "" || $to == "" || $timestamp == "" || $text == "")
{
echo "

Invalid parameters.

";
return;
}
?>
4. We can now split the text into order parameters then loop over them and add
items to the order. The following code shows the structure of this part, added
right after the previous code.
// Process the message here
// Message format is "POTR (Item Code)x(Qty)"
// Push a space around x so that we can split at space later
$text = str_replace('x', ' x ', $text);
// Convert all double spaces into single spaces
while(ereg(' ', $text))
Chapter 8
[ 153 ]
{
$text = str_replace(' ', ' ', $text);
}
$text = strtoupper(trim($text));
// Now we can split at space to get order parameters
$params = explode(' ', $text);
$identifier = array_shift($params);
if ($identifier != 'POTR')
{
echo "

Invalid command.


Pages:
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206

druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6