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 138 | Next

Nirav Mehta

"Mobile Web Development"

We can even validate the phone number using
some pattern. But for now, let's perform basic cleanups of removing spaces
and the '+' sign from the number. The following code shows the Send and
CleanUpPhoneNumber functions.
public function CleanUpPhoneNumber($phone)
{
$phone = trim($phone);
$phone = str_replace(" ", "", $phone);
$phone = str_replace("+", "", $phone);
return $phone;
}
public function Send($to, $from, $msg)
{
$command = "sendmsg";
$to = $this->CleanUpPhoneNumber($to);
if ($to == "")
{
return 0;
Chapter 6
[ 107 ]
}
$params['to'] = $to;
$params['from'] = $from;
$params['text'] = $msg;
$message = new Message();
if ($this->Request($command, $params))
{
return $this->lastResult;
}
return 0;
}
4. The important parts here are the "sendmsg" command, and to, from, and text
parameters. They tell Clickatell to queue the message for delivery.
5. Let us modify our processOrders.inc.php and add SMS sending to it.
When the status is changed from new to processing, we will send a message
to the customer, notifying her or him that the pizzas are on their way! To do
this, initialize an SMSGateway object, authenticate with the gateway, and then
send out messages in a loop.


Pages:
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6