I believe this topic is good for application developers. In this short article we will learn how to created SMS gateway and applicated it on worldwide-web using PHP script. What is SMS? SMS stands for short message service. It’s the text communication service component of phone or mobile communication systems, using standardized communications protocols that allow the exchange of short text messages between fixed line or mobile phone devices… more details about SMS please read in wikipedia.

I already written about how to build SMS gateway on my “Bahasa Indonesia” blog, but many people give negative comment on that article because that article is just illustration without real product. There is nothing goes wrong on that article, everything has requirement to created SMS gateway. I think people commenting negative on that article because they never use their brain to “think outside the box“.

Here is image illustration how SMS and Internet can be combined, this application can created a better experience for end users :

Enough for my bad introduction, before we start to learn how to created real SMS gateway we need some requirements in here:

  1. An computer to act as gateway and web-server.
  2. One or more Phone/Modem+SIM cards to act as connection between your SMS gateway and your provider.
  3. NowSMS program (60 days trials or buy) act as virtual machine to send and received SMS.
  4. Web hosting with PHP support (needed when you want to created an online worldwide-web application).
  5. An knowledge to solve a little problem.

[to_plus]

First, we have to make our computers to be a web-server. I recommended to use XAMPP. It works on windows/linux operating system. Use your knowledge to solve all problem you may faced on this step, no need to ask me everything 🙂 You may have to setting port forwarding on your router if necessary.

Next step is connecting your phone/modem to your computer. You can use USB-Cable, Bluetooth, Infrared, or anything that can be used to connecting your phone into your computer. Use your knowledge to solve all problem on this step. In this sample I used USB-Cable.

Next step is installing NowSMS and configure it. After you install NowSMS run it, program should show this screen, next click on add.

Choose which one fit on your configuration and then click OK.

Choose modem installed on your computer, then click test and add modem. In many case, mostly the problem is you might can connecting your Phone but your phone didn’t support for SMS. You can solve this case by use USB-Cable connection.

When you success on add modem, this screen will shown. make sure you click on test button once again.

Click on properties and write down your phone number, you can write phone/modem PIN if it required.

Run this sms gateway service when you needed to send SMS from worldwide-web application.

Try it on your local computers, by default port for SMS gateway is 8800. So you have to write http://localhost:8800 to see this form.

After this step our SMS gateway are ready to use. Next step is created application via PHP script to let us sending SMS or received SMS from internet.

Received SMS

First we have to created an MySQL database to recorded all incoming message to our database. Created a new MySQL database and then import this code:

# CREATE TABLE `inbox` (
# `id` int(5) NOT NULL auto_increment,
# `msg` text NOT NULL,
# PRIMARY KEY (`id`)
# ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

Next use this sample PHP script

# <?php
#
# // database
# $db_host = “localhost”;
# $db_user = “username”;
# $db_pass = “password”;
# $db_name = “database name”;
#
# // connect to mysql
# $link = mysql_pconnect ($db_host, $db_user, $db_pass) or die (“can’t connect”);
# mysql_select_db ($db_name) 0or die (“can’t select database”);
# $msg = trim($msg);
#
# //input to table inbox
# $sql = “INSERT INTO inbox
# SET id=”,
# msg=’$msg'”;
# $query = mysql_query($sql) ;
# ?>

Next step is configure setting on NowSMS program:

  1. Click 2-Way tab.
  2. Check Process Received SMS Messages
  3. Add SMS Command Prefix text, example: Idol (every SMS received with Idol prefix will added into database).
  4. Write your phone number on Receive Phone Number(s)
  5. Write http:/[yourdomainname]/[yourpath]/index.php?msg=@@FULLSMS@@ to Command to Execute.
  6. Click Add then click Apply.

When we received message to this phone number with right prefix it will automatically recorded into our database, on next step we can use this database to any application we need example: vote SMS, etc. Please be creative!

Sending SMS

Next, how we created an simple script to send SMS message from our web-server? I was searching on google and found this good sample script. It might be useful to use. Read the full sample SMS script in here. Use your imagination and be creative!

Ending

That’s it, enough the lesson for today 🙂 If you like this script you can donate to me *LOL* I’m just kidding… If you want to test SMS application you can try this http://sms.istanto.net it would sending SMS message to all Indonesian GSM/CDMA network. Have a good day everyone :):)

[/to_plus]

Similar Posts:

Related Search Terms:

    Digg Del.icio.us StumbleUpon Reddit Twitter RSS

If you're new here, you may want to subscribe to my RSS feed. You may copy or publish this article to your blog or other site as long you give credit link back to this site article. Thanks for visiting my blog!