How to send SMS from Adobe Coldfusion
On this page you will find detailed
information on how to send SMS messages from Adobe Coldfusion using HTTP
requests with the help of Ozeki NG SMS Gateway. A configuration guide and
an example source code are also provided in the article.
Introduction
If you would like to send data from one application to
another, you can use a simple but efficient method to do so. This method
is HTTP. Adobe Coldfusion is able to call to submit HTTP requests, in this
way it can be easily introduced to send mobile messages to cellphones. To
achieve this SMS functionality you need to implement a powerful and stable
SMS gateway such as Ozeki NG SMS Gateway. Ozeki NG SMS Gateway is a software
product that can be installed to your computer. With this SMS gateway you
can operate with SMS messages with the use of HTTP GET method call (Figure 1).
Figure 1 - How to send SMS from Adobe Coldfusion using HTTP
After the SMS gateway software has been installed to the
computer, mobile messaging will work as follows: to send SMS text messages
to mobile phones, the messages need to be forwarded to the SMS gateway.
The built-in webserver of the SMS gateway provides an HTTP SMS API that
allows to submit messages. After the messages arrived at the SMS gateway
they will be forwarded to the mobile network either with a GSM modem
attached to the computer with a data cable, or the gateway directly
connects to the SMS center of the mobile service provider over the Internet.
Prerequisites
To setup and operate this solution properly you need the
follows:
Configuration
First you need to download,
install and configure Ozeki NG SMS Gateway to be able to send SMS
messages. Then copy the html and cfm files provided in the zip file above
into webserver directory of Coldfusion. Then open "index.html" file and
fill the form. Click on "Send message" button. The cfm file will execute
and it will compile the HTTP request. The HTTP request will execute and it
gives a response xml file.
Example source code
Feel free to use and modify these source code samples!
Content of index.html:
<html>
<body>
<h1>Ozeki ColdFusion SMS example</h1><br>
<h4>Informations for Ozeki NG - SMS Gateway</h4>
<form action="ozeki-coldfusion-example.cfm">
Ozeki Ip address: <input type="text" name="ip" value="127.0.0.1"><br>
Username in Ozeki: <input type="text" name="username" value="admin"><br>
Password of the user: <input type="password" name="passwd" value="abc123"><br>
<br><br>
<h4>Message settings</h4>
Recipient:<input type="Text" name="to"><br>
Message:<textarea rows=4 cols=40 name='msg'></textarea><br>
<input type="submit" value="Send Message">
</form>
</body>
</html> |
Content of ozeki-coldfusion-example.cfm:
<cfset smsstring =
"http://#ip#:9501/api?action=sendmessage&username=#username#&password=
#passwd#&recipient=#URLEncodedFormat(to)#&messagetype=SMS:TEXT&messagedata=#URLEncodedFormat(msg)#">
<cfhttp url="#smsstring#">
<cfoutput>
#cfhttp.filecontent#
</cfoutput>
|
Dig deeper!
People who read this also read...
Next page:
VB 6 SMS API
|