Sunday, June 19, 2011

SMS based internet for social networking

I have heard a lot that people invent the ways when they face some problems. Few days back I also went through the same situation. Here is what gave me an urge to really do something that can help me to utilize my time while I am commuting. Everyday I travel in a BMTC Volvo to work. It is a torture when you have to travel almost for 1 hr standing in a crammed place and with 10 people pushing you every time when the driver presses a brake. Reading books is out of question in this situation. The next best thing is to check my Facebook status or personal mails. But I don’t prefer taking out a flashy phone in these conditions because the chances for the damage are high. Every day I thought how can I use my old phone and still manage to perform some of the common tasks of status updates, checking mails or tweet some of the funny observations while I am standing in the bus. I finally decided to apply technology to improve my life.
Few days back I had read an article regarding text based web. Text based web is basically about obtaining information from the web by sending the SMS to a particular service. There are few SMS platforms like http://www.google.com/mobile/sms/, http://www.txtweb.com which help in fetching the information from the internet and sending to the mobile phones via SMS.

I thought of exploring this concept and try to develop my own applications that can receive the SMS and then perform some operations.
As you all must know that the information in case of website is fetched using the HTTP requests. So when the user types a URL to fetch the page he is basically sending a HTTP request to the application server that can return the HTTP response for that request. The following diagram briefly summarizes that (the details on HTTP is easily available on the net and so I am not going to discuss that)

1. You enter a web page address in your browser’s location bar.
2. Your browser breaks apart that address
and sends the name of the page to the web server. For example, http://www.ndtv.com/index.html would request the page index.html from www.ndtv.com.
3. A program on the web server, called the web server process, takes the request for index.html and looks for this specific file.
4. The web server reads the index.html file from the web server’s hard drive.
5. The web server returns the contents of index.html to your browser.
6. Your web browser uses the HTML markup that was returned from the server to build the rendition of the webpage on your computer screen

Just to put everything in perspective, Facebook, Twitter, Gmail all have some Application server that is listening to your request and respond back with the information.

The platforms like http://www.google.com/mobile/sms/, http://www.txtweb.com, http://www.textmarks.com/ can convert the SMS to an HTTP request and can convert the HTTP response back to a SMS. This is important since you can now communicate with the application server by sending the SMS.


The concept is described in the following diagram



Step 1,2. Using the mobile send a SMS to the SMS platform using the mobile carrier
Step3,4. The SMS platform will convert this SMS to an HTTP request and send it to the application server via internet.
Step 5,6. The Application server will act on the request and then create a HTTP response and send it back to the SMS platform via internet
Step 7. The SMS platform will now convert the HTTP response back to an SMS and send it to the mobile phone via Mobile carrier.
his is different from how the normal apps on smartphones work. They can send/receive a HTTP request/response directly without any conversion so the application communicates almost like a website

This is different from how the normal apps on smartphones work. They can send/receive a HTTP request/response directly without any conversion so the application communicates almost like a website

So with the above concepts in mind I decided to develop my first application. Since the whole idea was born in BMTC Volvo so I decided to create a textApp (named on the lines of mobile apps) to find the routes of Volvo bus. As a user I might like to find out what is the route of “volvo 500K”.
The building blocks of my application are
1. SMS platform
2. Application server hosted on public domain
3. Application to find the bus routes
For SMS platform I used used txtweb (http://www.txtweb.com). It is very simple to use and configure.
The following diagram explains how it work



All you need to do is to choose a keyword and associate it with a URL that will understand this keyword. The URL is the address of your application that will find the routes. This keyword along with the parameters need to be sent to 924334200.
For ex.
@bmtcvolvo 500k
And I get a response as
ROUTE:V500K
Vijayanagar Bus Station=>Vijay Nagar Maruthi Mandir=>R P C Layout=>BHEL Factory=>Veerabhadra Nagar=>Dwaraka Nagar=>Hoskerehalli=>Kamakya (Depot 13)=>Banashankari BDA Complex=>Banashankari Bus Stand=>Jayanagar 5th Block East=>Ragigudda=>BTM Mico Layout=>BTM 16th Main=>Central Silk Board (ORR)=>HSR 14th Main=>Agara=>Jn of Sarjapura Road=>ECO Space (RMZ)=>New Horizion College (ORR)=>J.P.Morgan=>Marathahalli (Mulitplex ORR)=>Spice Garden=>AECS Layout=>Kundalahalli Colony=>I Gate (Perot Systems)=>Sathya Sai Hospital=>ITPL Main Gate

The way it works is
1. You will register a keyword (@bmtcvolvo) on txtweb
2. You then associate the keyword to a URL. So @bmtcvolvo is associated to a URL lets say http://www.testURL.com/bmtcresponse.php
When you do that the txtweb will create a mapping table that will say that if a sms contains @bmtcvolvo the http request is to be sent to http://www.testURL.com/bmtcresponse.php

3. When you send a SMS @bmtcvolvo 500k, the txtweb platform receives it and then finds the mapping for the keyword @bmtcvolvo. It then forms a request
www.testURL.com/bmtcresponse.php?txtweb-message=500k

4. Now my application knows that GET parameter txtweb-message is the bus number.
5. I have fetched the data from BMTC site to construct a database of the bus routes. This table is used to find the route information for 500K
6. The application will then send back the information in the form of http response which basically means to print a html page.
Something like
".$routeNumber."
".$shortRoute."";

7. The txtweb platform will convert this information into an SMS and send it back to the phone.

Once I got it running, I fulfilled my goal of updating Facebook and twitter based on the exactly same approach. All my Facebook updates also contain a “via rPhone” tag just to keep people confuse that I have some new cool phone!!!.
Hopefully my commuting time will become more enjoyable than before.

6 comments:

Soul said...

Nice and interesting read.
I have one question. In the step 6 you have written something like this
"6. The application will then send back the information in the form of http response which basically means to print a html page.
Something like
".$routeNumber."
".$shortRoute."";"

Now my question is What is the response? because .$routeNumber doesn't make any sense.

Rohit said...

Actually it is a url string
and some part of it got rendered.

Rohit said...

Basically I will get the details of the route number in the response

Anonymous said...
This comment has been removed by a blog administrator.
prabhas said...

Videocon prepaid mobile recharge anytime, anywhere – Recharge online instantly and stay connected with your loved ones. online recharge

Blogger said...

Bluehost is one of the best web-hosting company with plans for all of your hosting requirments.