Click here to Skip to main content
12,821,494 members (23,313 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


13 bookmarked
Posted 12 Sep 2011

How to add SMS functionality to websites

, 8 Apr 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
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: ) 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.


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


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 3 Has tons of potential to be a long a... Pin
BrianBissell20-Sep-11 4:07
memberBrianBissell20-Sep-11 4:07 
GeneralReason for my vote of 1 Simple theory, no practice Pin
VMAtm20-Sep-11 2:13
memberVMAtm20-Sep-11 2:13 
GeneralRe: Instead of giving a vote of one, you could submit an alterna... Pin
BrianBissell20-Sep-11 4:06
memberBrianBissell20-Sep-11 4:06 
GeneralRe: Instead of giving a vote of one, you could submit an alterna... Pin
Ed Nutting8-Apr-12 6:51
memberEd Nutting8-Apr-12 6: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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170308.1 | Last Updated 8 Apr 2012
Article Copyright 2011 by Ozeliltd
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid