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

Nirav Mehta

"Mobile Web Development"

We can now instantiate the message class when we are sending the SMS
in the SMSGateway class. Populate the values in it and save it to the table.
The Save() function will give us the auto-incremented primary key of
the table, and that in turn can be passed to the Clickatell gateway as client
message ID. The following code shows the modified Send() method in the
SMSGateway class.
public function Send($to, $from, $msg)
{
$command = "sendmsg";
$to = $this->CleanUpPhoneNumber($to);
if ($to == "")
{
return 0;
}
$params['to'] = $to;
$params['from'] = $from;
$params['text'] = $msg;
$message = new Message();
$message->to = $to;
$message->message = $msg;
$message->requestDate = date("Y-m-d H:i:s");
if ($message->Save())
{
$params['climsgid'] = $message->id;
if ($this->Request($command, $params))
{
$message->gwId = $this->lastResult;
$message->status = 'Q';
if ($message->Save())
{
return $this->lastResult;
}
}
}
return 0;
}
4. We now have records being inserted every time a message is queued
onto Clickatell!
Sending Text Messages
[ 112 ]
Querying for Message Status
If you noticed, the messages are saved with default blank status first.


Pages:
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6