Once we get
the result from the gateway, we update the message row with "Q" as the status. This
way if a message's status is blank, it means it was never queued to the gateway.
Clickatell returns an ID for each message we queue??”which is what we store in
the gwId field. We can use that ID to check the status of the message delivery. The
Clickatell API to check message status is like the following:
Command: http://api.clickatell.com/http/querymsg?session_
id=xxx&apimsgid=XXXXX.
Response: ID: xxxx Status: xxxx or ERR: Error number.
We can even use the client message ID (climsgid) to query message status.
Integrating the querymsg command with our class is simple. We can add a new
function QueryStatus($gwId)and make a request to the gateway. Clickatell
returns numeric codes for the status (refer to the Clickatell API documentation at
http://support.clickatell.com). We can process the returned status code and
update our message table accordingly.
What we are doing here is polling for message status. Polling is a good solution
when you want the status of particular messages, but Clickatell provides another
method for getting message status.
Pages:
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157