What Just Happened?
Our SMSGateway class creates a URL to call based on the command and the
parameters. The first command is to authenticate, so it does that in the Init()
function. The Request() function makes the actual request via the file() function.
At this time, the Clickatell gateway receives the requests, confirms the validity of the
session or login information, and sends back a result.
The result is in two parts separated by a colon. The first part is the status code and
the second the actual value. Our Request() function splits the response at the colon,
and checks if the status code is an error. If it is, we return false. We also store the
latest result from Clickatell in the lastResult variable in all cases. This can be used
later, e.g., to store the session ID so that we can pass it with subsequent requests.
We have hard-coded the API ID and From number in our code. Ideally, it should
come from a configuration file. The rest of the code is to update the table and show
the result to the administrator.
This is what happens on our server. But how does the message actually reach the
customer? Let's see how.
Chapter 6
[ 109 ]
So What Happens at the Gateway?
Clickatell, or any other SMS gateway, is connected to multiple mobile operator
networks.
Pages:
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152