Categorized | News, Programming

Tags | ,

Sending SMS Thru HTTP

Posted on 13 May 2005 by Demian Turner

Introduction

SMS (also known as text-messaging) has grown into a very popular method of communication. It has been around in Europe and Asia since the early nineties and its use is steadily increasing in the US as well.

SMS stands for "Short Message Service" and uses mobile phones to transmit (surprise, surprise) short messages to and from mobile phones and whilst many of us might not know this, it is also possible to send SMS messages from a website or a piece of software.

There are an infinite number of reasons why you might want to use your website to send SMS. You might want to add a "send by SMS" option to your headlines, for example, or you might want to provide 24/7 support in which your technician is alerted by SMS or you might simply want to provide your viewers with Free SMS to drive traffic to your site.

Although it is also possible to send SMS via e-mail, this tutorial will teach you how to send SMS using GET and POST HTTP methods in PHP (since it’s the language I know).

Bookmark and Share

23 Comments For This Post

  1. Demian Turner Says:

    Hey Farheen, this is a great tutorial, thanks for submitting it :-)

  2. Farheen Says:

    No problem!

  3. Ben Says:

    I will like to know how to send SMS using get and post ( sending the SMS as an email), so I will have a drop down menu where the user will choose from a list of cellphone carrier ( like pacific bell, T-mobile, etc,etc )and the user will only enter the number wich then it will replace the #### on the ####@pacbellpcs.net (if they choose Pacific Bell) or any other carrier from the drop down menu. Plus a user name to fill in ( Subjet) and then a small message to fill in.
    I can send it using my email program, but I will like to to have it in a webpage.
    Any idea on how to do it using a form?.
    I will apreciate your help.
    Thanks

  4. adam beaumont Says:

    hi there

    we’re a mobile messaging solution provider and i think our gateway will work in almost an identical manner to this. We also offer backup gateways for redundancy.

    Also, we have some more code samples that may be of interest.

    Have a look at :

    http://aql.com/site/developerinfo2.php

    and

    http://aql.com/downloads/software/ssss-v1.01.tar.gz

    this isn’t meant to be a blatant sales pitch, but more an offer of help to anyone who is having fun trying to connect to sms gateways….

  5. Farheen Says:

    No doubt. This tutorial can be applied to almost any gateway that provides support for http. Anyone who wants to use it should compare gateways and choose the one that suits them most.

    Thanks for the comment. I’m glad you like the tutorial.

  6. lida Says:

    salam

  7. Farhan Says:

    it was realy good and also helpful.

  8. I'll blog your mind reloaded ! Says:

    PHP Kitchen have published recently an article about Sending SMS Thru HTTP. I guess there is many others articles and APIs also, bu

  9. lettie Says:

    Hi

    Couple of questions on your script above.

    1. Are there any security issues? i.e. with automated bots using your gateway to send out spam text.

    2. Do you know of any tutorials or scripts that do the same in reverse and accept sms into a mysql db for displaying on a web page?

    Cheers

    Lettie

  10. Abba Bryant Says:

    This is awesome. I went to both sms service providers and found both to be comparable.

    I may just work this into an sms sending class and implement list sending for some band websites I am working on. thanks.

  11. Sukh Says:

    Hi, that was a great tutorial…but can u tell me how and where i would modify it to make it work for o2 free sms??

    the password is shown in the url, thats a big security risk isnt it? might be better to use post.

  12. Rambo Says:

    Hey Farheen, thank you so much for this tutorial. I have now signed up with TM4B they are awesome.

    After spending ages trying to do a ‘silent’ HTTP POST (still can’t believe this is not supported by PHP natively) I had almost given up home. You have save me hours.

    Cheers

    Ray.

  13. SimonUK Says:

    Thanks for the help. We are using it to send HTTP POST to Kapow! (http://www.kapow.co.uk/) and are VERY happy with it so far!

  14. colin Says:

    Using SMS in a Box at http://frameworx.dk/smsinabox

    Also supports TM4B and also Clickatell so you can switch between the two. Regular modem can also be used with the same interface as used to connect to the HTTP SMS providers.

  15. sam Says:

    Hi, that was a great tutorial…but can u tell me how and where i would modify it to make it work for o2 free sms??

  16. Abdulla Asiri Says:

    Thank you very much Farheen for this tutorial, and I have three questions :

    1- what is the difference between GET, POST
    2- This example uses GET. if we want use POST, what we shuold to do .
    3- Is this PHP Code is the use directly with our website without any changes

  17. ocptime Says:

    Hello Asiri,

    for more info about the difference between GET and POST there is a nice article at
    http://sgcet.blogspot.com/2006/02/should-i-get-or-should-i-post.html

    ocptime

  18. Shamira Says:

    Hey man this tute was cool.
    Hey i just got a question.Can we receive sms as emails to our system by using this gateway ? If can then what is the method ?

    Please reply with a solution to email address and i appreciate your help very much.
    Thankx

  19. ramesh Says:

    hi
    iam a web developer from nepal ia eant to start a web as your
    please tell me wether i need a sim or not to implement that code

  20. Chinecherem Says:

    Hi,
    I raelly apprecita this article. Honestly i want to biuld an application that will be sending sms, but i dont really understand the concept of tm4b and how i can register with them to enable me have a user name and password as fast as possible. And also i want to know if i can use effeciently in my country i.e Nigeria. Thanks and God bless

  21. malik Says:

    goooooooooood

  22. quantumphp Says:

    This may be useful to some of you. There is a tutorial at

    http://www.easykiss123.com/?p=32

    It is a video tutorial and a free script for putting an sms enabled contact form in your site. The form sends you an email and an sms alert letting you know a user has filled out the form.

  23. kislay Says:

    I still am not able to configure..out of the three program you have mention above which one i need to use… cn u plese tell me the flow in steps starting from the html form

    I want to use this sytem for an mobile alert for this website http://www.carpoolglobal.com

Leave a Reply

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook