Click here to Skip to main content
15,884,472 members
Articles / Productivity Apps and Services / Microsoft Office
Tip/Trick

How to add SMS functionality to websites

Rate me:
Please Sign up or sign in to vote.
2.43/5 (4 votes)
8 Apr 2012CPOL4 min read 44.3K   15   4
SMS tools for business.

This article was born to guide you through the process of adding SMS functionality to your website. Being able to send SML messages directly from your site can attract much more visitors (customers, business partners, etc.). First of all, let’s see the basics of SMS sending.

For sending messages, you most importantly need an SMS gateway to connect to the mobile network. This can happen in two ways: with a GSM modem, or over the Internet. If you choose the appropriate software, it will support both connections. By configuring more GSM modems and/or Internet (IP) connections, you can achieve high performance and outstanding stability.

If you have a GSM modem connectivity, it means that a GSM modem (or GSM phone) is attached to your PC with a phone to PC data cable. The modem has a SIM card which allows to connect to the GSM network. To setup this connection method, you need the following components:

SIM card + Modem + Data cable + Computer + SMS Gateway (SMS software)

For having an Internet based connection (IP SMS connection), a TCP/IP link is used to connect to the Short Message Service Center (SMSC) of a mobile network or an SMS service provider. So you need to find an SMS service provider who can reach the mobile phones in your area and is able to provide SMS service through the Internet. In order to setup this solution, you need the following prerequisites:

SMS Service Subscription + Internet connection + Computer + SMS Gateway

In general, when you make a decision whether you want to use an Internet SMS connection or a GSM modem, the first and most important thing to check is the volume of SMS messages you expect to be sent or received in the system. If you will send or receive less than 12000 SMS messages per day, a GSM modem will probably be a good option. If you will send or receive more, you should consider using some kind of Internet SMS connection.

Let’s assume you have set up your SMS system, and come straight to the point. The method I’m presenting uses an HTTP communication between the SMS Gateway

(for example: http://www.ahra.ir ) and your website. The website visitor only has to fill in a form (with the recipient's number and the message), which will be sent to the web server by the browser. This HTML form can be submitted by clicking on a button (with „OK” or „SEND” on it, for example). When the visitor presses the button, the phone number and the message will be sent to the web server in HTML form. There, the utilized scripting support processes the submitted request (and forwards them to the database). This script will post the SMS message to the SMS Gateway. Once the message is in the Gateway, it is converted to SMS, then sent to the recipient’s mobile phone. The process looks like this:

HTML form -> Webserver -> SMS Gateway -> Mobile users

It isn’t necessary for the web server and the SMS software to be on the same computer. But scripting support has to be enabled on your web server. This is the most important condition. The support can be PHP or ASP, too.

To make it more understandable, let’s repeat the main steps of the process:

  1. The user’s browser queries your website from the web server.
  2. The web server sends back an HTML form.
  3. The user fills in the form, and submits the request by clicking on the sending button.
  4. The script (e.g., ASP, PHP) processes the form and records the data in the right database.
  5. The request is sent to the SMS Gateway by an HTTP API.
  6. The Gateway sends out the message to the given phone number.

So if you already have a website (that is on a web server), you only have to install your SMS software and verify that you can send SMS messages from the gateway manually. After your SMS gateway is functioning, you can create the HTML form and the PHP script. With a little work and a decent SMS Gateway, website visitors will be able to send messages from your site in no time.

SMS sending from a website can be very tempting for people, so you can be sure of that if you implement a function like this in your site, visitors will crowd in. Examine your needs and opportunities, and give this standalone function a chance. You won’t regret.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 3 Has tons of potential to be a long a... Pin
BrianBissell20-Sep-11 3:07
BrianBissell20-Sep-11 3:07 
GeneralReason for my vote of 1 Simple theory, no practice Pin
VMAtm20-Sep-11 1:13
VMAtm20-Sep-11 1:13 
GeneralRe: Instead of giving a vote of one, you could submit an alterna... Pin
BrianBissell20-Sep-11 3:06
BrianBissell20-Sep-11 3:06 
GeneralRe: Instead of giving a vote of one, you could submit an alterna... Pin
Ed Nutting8-Apr-12 5:51
Ed Nutting8-Apr-12 5:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.