Send Free SMS - Web Service
July 17th, 2008
27/Sep/2008 - Important Update 3: The web service has been updated yet again. If you are using the script on your own server, then please download the zip file again. Extract this zip file in the same place where sendsms.php is currently located and you should be good to go.
02/Sep/2008 - Important Update 2: The web service has been updated. If you are using the script on your own server, then please download the zip file again. Extract this zip file in the same place where sendsms.php is currently located. The zip file now contains an extra file named “htmlparser.inc” (version 1.2) from PHP HTML Parser. It’s an awesome library to parse HTML using PHP.
Important Update: After this comment from cssk, the web service has been updated. If you are using the script on your own servers, please download it again from here and just replace the existing file. Others, who are just accessing the URL on my domain needn’t make any changes to their code.
Hi friends, if you are in India and if you are developing software prototypes which has to send SMS alerts to various Indian mobile numbers, you needn’t spend a lot to buy SMS credits at the various sites. Over the last weekend, I spent some time hacking up a quick SOAP based web service which you can consume in your programs.
Before we proceed further, here are a few things you have to do:
- Get an account at http://www.way2sms.com/. Its a free SMS service and has tons of advantages; including 92 characters per message (rest of the characters are ads) and unlimited number of messages per day.
- Now you can invoke the web service in two ways from my domain itself. Web service endpoints and other notes given below.
- You can get the PHP source code and set it up in your own server.
Invoking the Web Service:
- The web service end point is at http://www.aswinanand.com/sendsms.php?wsdl. More details on how to consume a web service using Visual Studio is available here. Feel free to try with other languages and IDEs and let me know.
- Instead of consuming the web service, you can invoke the URL directly with the four parameters. Parameters are:
- uid = your way2sms user id
- pwd = your way2sms password
- phone = semicolon separated list of phone numbers
- msg = actual text message
- An example URL format is http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&pwd=__PWD__&phone=__NUMBER__&msg=__MSG__.
Setting up the web service in your hosting space:
- Grab the SMS web service source code from here. The source code is licensed under “Creative Commons Attribution-Noncommercial”. Make sure you agree to the license terms before downloading
and kindly link back here or digg it. - Get the NuSoap library and upload it to your server. You may want to change line number 50 in our web service source code to point to the proper location of NuSoap on your server.
- Now as mentioned in the section above, you can now use the web service from your domain. Just replace “http://www.aswinanand.com/” with “http://www.your-domain.com/path/to/source/” and you should be good to go on your own :D
Improvements:
Of course, there are lots of improvements that can be made to this service. Way2SMS console gives you a list of all the messages that have been sent from your account so far. So, you could write another web method and expose it; which returns all the messages so far in the form of RSS feed, ATOM feed or JSON.
Any text after the 92nd character in the SMS is cut off. We could write a simple loop after line 36 to send multiple messages if the number of characters exceeds 92.
We should also be able to retrieve the list of contacts that are saved in Way2SMS as JSON feeds and reuse them to send messages instead of typing in mobile numbers directly.
I will update the script as and when time permits and update this space. Keep watching for more. This sort of web services can be developed for almost all SMS web sites. If you are developing a similar script for other SMS websites, let me know.
Some boring blah blahs:
- The code is not production grade. It was hacked quickly over a weekend. So use it at your own risk.
- You cannot hold me responsible for whatever problems that may occur for you in using this web service.
You could also do me a small favour by digging this post. Thanks!

August 7th, 2008 at 4:43 pm
hi,
i got the wsdl which is published by u.but it shows error : import schema for namespace was not resolved”
so i cant add this wsdl file to my webreference.
is this have any solution?
August 8th, 2008 at 2:46 pm
hi dost kaise ho
August 9th, 2008 at 8:01 am
Muthu, I’m unable to get the same error. I’m able to access the WSDL as easily. Do you have any other namespace with the same name?
August 19th, 2008 at 6:53 pm
Hey good post but i am unable to send any sms
i tried both the method of using ur web service in asp.net and directly running the link
http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&pwd=__PWD__&phone=__NUMBER__&msg=__MSG__.
can u suggest me
August 20th, 2008 at 10:08 am
@cssk:
I just noticed that the way2sms website has changed a bit. I’m making the code changes. The new updated web service will be up tonight.
Thanks for the info.
August 20th, 2008 at 12:39 pm
Thanks for the reply
can u post some code of using the webservices in asp.net application that wood be very good.
One more thing i am trying to use an other webservice
http://www.webservicex.net/SendSMS.asmx?wsdl
but little sucess
is there any other web service which can be used
August 21st, 2008 at 6:16 pm
Hi Aswin
Is ur Webservice working?
Still Trying to get …..
August 23rd, 2008 at 10:08 am
@cssk:
I have updated the web service now & it works properly for me. Please try it out and let me know.
I have tried webservicex.net’s SMS web service. But since it didn’t work, I created this
Thanks!
August 23rd, 2008 at 11:45 am
Hi Ashwin It’s Working….
Thank u
August 23rd, 2008 at 7:46 pm
hi muthu, i can use ur webservice but u told that unlimited msgs can be sent, no its no correct only limited (arround 60) msgs can be sent, so, u please check it again and try whether there is any other wsdl to send more no.of sms or v can send more from way2sms.
Reply reqd urgently. tnx in advance.
August 24th, 2008 at 6:09 am
@vivin:
You can send as many messages as way2sms.com allows. AFAIK, there are no limitations on how many messages you can send per day using the site.
August 25th, 2008 at 3:02 pm
Hi aswin.
I am using the URL http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&pwd=__PWD__&phone=__NUMBER__&msg=__MSG__. which provided above to send SMS. I am receving the output status as ‘DONE’ but i am not receiving any messages. Is there any restrictions, will the message receive for only particular providers?.
Kindly Reply.
Regards
Bala..
August 25th, 2008 at 9:58 pm
Bala,
Hope you have created an account at way2sms.com and replaced the following details in the mentioned URL:
1. replace __USER_ID__ with your way2sms user id.
2. replace __PWD__ with your way2sms password.
3. replace __NUMBER__ with the number to which messages has to be sent.
4. replace __MSG__ with the actual message to be sent.
I tried with my user name and password and it works perfectly. Most of the time, you will get the SMS within a second or two after the “done” message displays.
August 31st, 2008 at 3:12 pm
I went ahead and modified the freely available rss2html to lookup a gmail feed (via freemyfeed.com) and send a sms via your scripts.. this leads to alerts with a small snippet of the mail
Thanks for your script.
August 31st, 2008 at 3:58 pm
@someone:
Hey, that’s a pretty cool use of this SMS API. Appreciate that!
September 1st, 2008 at 9:17 am
looks like they changed it again.. i cant seem to send messages using the script.
Contact me for the mail alert script at the email id i’ve entered for this post
September 1st, 2008 at 6:00 pm
Hi Aswin.
Thanks For ur reply. On that day itself i checked again by creating new user in way2sms,its worked fine.But, Today the URL http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&pwd=__PWD__&phone=__NUMBER__&msg=__MSG__is not working. Whether any updates is going on.
Regards
Bala..
September 1st, 2008 at 11:38 pm
@Bala:
Another user has emailed me saying that the script is not working today. I’m looking into it.
September 2nd, 2008 at 1:33 am
@bala, @soneone:
You can now send SMS through the given URL.
September 4th, 2008 at 5:09 pm
Dear Anand
I have added the webservice to my application
I haven’t received any message
It works even when i give wrong password
Please help me
Thanks
Santosh
September 4th, 2008 at 11:33 pm
Hi Santosh, which version of visual studio are you using? I just consumed the SOAP web service and it worked out just fine. The WSDL is available at http://www.aswinanand.com/sendsms.php?wsdl
September 9th, 2008 at 12:16 pm
sms is not send by your website by using
http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&pwd=__PWD__&phone=__NUMBER__&msg=__MSG__is not working. Whether any updates is going on.
September 10th, 2008 at 8:19 am
Krishna, the URL is working very well. You need to make sure to have a way2sms user ID and password. Are you having that? Have you read the instructions carefully before invoking the URL?
September 11th, 2008 at 6:11 pm
Hi muthu,
Thanks for ur reply. I consumed ur webservice using my Java Client program, its working fine. I made some improvements to my Java web application ie 1)Long Messaging Service(LMS) like SMS, which allows us to send a text message of any length. 2)Calendar Events or Remainder Service, which allows us to set some remainders or calender events like B’Days and other important occasions and when that event fires then respective SMS/LMS is sent to them. But muthu, in my LMS service i’m unable to send more no.of msgs ie, when split the long text msg into no.of short msgs if the number exceeds some 60 or 70(approx) then the response from ur webservice is “done” as usually but, the remaining msgs after that limit are not being sent and when i try to send any msg there after in Way2sms.com its saying “Policy Violation Error: Too many msgs sent in a short period of time, Plz try later”. So please u chekt it out or try to send more than 100 sms from ur webservice/url. Any how its a very good job from u. Is there any way to retrive msgs sent to us from our client programs ie either by using other wsdls or by any other means. By the way did u try any other webservices to send free sms, I tried many but none is working (at free of cost). If u tried any such which were working please let me know. Awaiting ur reply. Thank u once again.
Regards
Vivin.
September 11th, 2008 at 9:56 pm
Hi muthu, May I know ur details(like academic & professional) if u don’t mind
September 11th, 2008 at 10:56 pm
@vivin:
& I’m an engineering graduate and working for a software firm in Chennai.
Hey vivin, thanks for visiting my blog. Btw, I’m not “muthu”. I’m Aswin
The web service was quickly hacked over a weekend & hence, those validations/checks need to be put into place.
September 12th, 2008 at 1:28 pm
Hi aswin, thanks for ur reply. sorry for assuming u as Muthu, anyhow can u tell me are any other successful wsdl to send unlimited sms a day.
September 12th, 2008 at 10:18 pm
Vivin, I don’t think such a web service ever exists because of obvious reasons (spamming etc.). May be you can use paid services like the ones at http://www.smscountry.com.
September 13th, 2008 at 4:12 pm
Thanks for ur reply Aswin. what are you working on now, I mean any further progress in hacking Way2sms.com or any work done in sending sms using webservices for free of cost etc.
September 13th, 2008 at 11:06 pm
Vivin, I’m working on automating smslife.in now
September 13th, 2008 at 11:21 pm
Tnx for ur reply aswin. Is it your professional work or your personnel work? any how can u give me some detailed description on “Automation of smslife.in”. Thanks in advance.
September 14th, 2008 at 1:07 am
thanks for making me to know and use voice remainder service in smslife.in its working beautifully and it will be really amazing if that voice sms facility is enhanced to sms,alerts etc
September 14th, 2008 at 11:36 am
Vivin, automating is pretty simple. Its just a set of CURL (http://php.net/curl) requests and tracking responses, and validating them. You can go through the source code for the way2sms web service, which uses a similar technique. You can get the source code at the top of this blog post.
September 14th, 2008 at 11:38 am
Doing this is just for fun
so that I can use them on my sidebar without having to visit the site everytime.
September 16th, 2008 at 10:44 pm
Hi aswin, thanks for ur reply. I am java guy, so can you help in that way.
September 18th, 2008 at 1:28 am
Sure Vivin. What help do you require?
September 25th, 2008 at 12:38 am
Hi aswin yesterday webservice is working properly and all of a sudden today its not working……… what happen to the webservice im flex developer an im doing it from flex application… please update if the webservice is updated
September 25th, 2008 at 8:35 am
Balu, the web service can be used with any development platform. Looks like way2sms.com has undergone some changes. Will check them & make an update to this blogpost in a day. Please stay tuned.
September 26th, 2008 at 8:47 am
Hi aswin, I want to set the web service in my own server, so can you please upload the latest/updated source(sendsms) in Java coz I am a Java Web Component Developer.
September 27th, 2008 at 8:47 am
Hi Aswin,
I have used your wsdl to send sms from my .net application. Every thing works fine but am not receiving any message. any updates going on from your end?
the service is accepting null/blank password
(i.e) working without any password given.
Can you suggest any possiblities of mistake that am making?
Thanks
Jp
September 27th, 2008 at 2:16 pm
Vivin, first priority is to stabilize this PHP web service. Of course I’m having plans to write a small library for .NET and Java too. Is it possible for you to maintain the Java library? Please let me know
I would love that.
JP, way2sms have some minor changes to the way the website sends SMS. I’m examining those changes & incorporating them. The changes will be released tonight. Regarding the empty password thing, I haven’t done much validation in the PHP side, mainly because I needed to get this out first. It will be taken care of in the next release after tonight’s release. Hope that’s fine.
September 27th, 2008 at 6:25 pm
Aswin,
Thanks for your response. Waiting for your Release.
Thanks again,
Jp
September 27th, 2008 at 7:57 pm
Hi aswin, I really love to maintain that webservice in my own server/machine. So, plz let me know how to maintain the Java library in my machine(is it by putting the path of the java class files in the classpath coz I am not sure abt it). Anyhow please let me know in detail.And when r u going to release ur new updated webservice, awaiting ur java lib release also. Thanks aswin.
September 28th, 2008 at 1:25 am
@JP, Vivin: The web service is back. You can send SMS now. I will be looking into the validations in the coming week.
@Vivin: By maintenance, I meant about making future code changes and minor enhancements that may come along the way, like what I’m doing now to this PHP thing. Would you be able to maintain that? If so, kindly let me know. I will hack up a quick java program.
September 28th, 2008 at 3:05 am
Aswin,
The code worked fine for me initially and its not working after sending few test messages.
Is it possible to build .net code library?
Can we do it?
Thanks,
Jp
September 28th, 2008 at 4:33 am
Thanks Aswin,
I can maintain the code, but I can do it if u provide me the code in Java, and really like to do some enhancements and of course I already did some like: Remainder service, Long message sending etc. Aswin, if u don’t mind can u tell me the process of hacking also.
September 28th, 2008 at 6:40 am
@JP: I tried sending a few messages by invoking the URLs and it worked well. Can you let me know after how many messages it stopped working? Yes, .NET code library can be built.
@Vivin: Yes, the initial java code library can be built.
For both the .NET and java library, allow me to use a week’s time. I will not be working on them because its a weekend
So by next weekend, I can give a nice .NET & a java library.
September 28th, 2008 at 8:03 am
ok aswin thank u. I will be awaiting ur java library. Mean while can u tell me the process of hacking also, I too will have try on that and I am very much interested also. or atleast let me know any good site(free) for learning hacking or give me some doc to learn how to do that. Thanks in advance.
September 28th, 2008 at 12:49 pm
Hi Aswin good work. plz do upload the .net library so that I can also look into it and hope to maintain it.
September 28th, 2008 at 2:02 pm
Aswin,
I have sent 6 messages. Even now i tried to send through my code it is not working. I tested from your URL and its working fine. But not from my code.
Also there is no error thrown in the code. But the message is not received. I tried to put one For Loop in my code. Before that it was working fine. Is that could have cause any trouble?
As Vivin Suggested can you through few lights on how to hack / what is the process involved am very much eager to learn few techniques and utilize it in a useful way. can you mail me jpxgen|at|gmail|dot|com
Thanks in advance.
September 28th, 2008 at 7:07 pm
Joyce, thanks a lot for the offer. I will be releasing the .NET and Java libraries on the coming weekend (within 4th & 5th Oct). You can take control of the source code from then onwards.
Jp, there has been no “hacking” here. Please don’t get the wrong picture
By hacking, I meant that a quick solution has been arrived at. Breaking into various systems means “cracking”, which we are *not* doing here.
As far as how the code is implmented, there is one function named “sendSMSToMany”. It accepts 4 parameters. They are the user id, password, phone number and message. This function then sends a few HTTP requests to the way2sms server for logging in and sending the messages. Please go through the PHP code and let me know your doubts. I will be very glad to answer them. The code is well commented.
September 28th, 2008 at 10:57 pm
Aswin,
Anyway let me give a try.
Sorry for the word Hacking. In spite of curiosity i have used that term. I will look into the PHP code. But i don’t have any idea about PHP
September 28th, 2008 at 11:58 pm
Yeah sure aswin I will look into it… but as JP says I am not able to send msg using ur webservice.
September 29th, 2008 at 2:05 am
JP, that’s the spirit
Get back to me if you have doubts after looking at the code.
Joyce, I just now accessed the URL and I’m able to send messages perfectly. Can you let me know how you tried to access?
September 29th, 2008 at 2:22 am
Aswin I have tried again now it is workin… thnks
October 3rd, 2008 at 11:16 am
Stopped again
October 3rd, 2008 at 12:53 pm
Hi aswin, the webservice is not working now, I think it was not working from 3 days. Are any changes are going on?
October 5th, 2008 at 6:42 am
@Vivin, @someone: Looks the way2sms website is down. I’m unable to access the website itself. Lets try again at the end of the day.
October 5th, 2008 at 10:39 am
Hi Aswin has the url changed I see wwwg instead of http://www.
October 7th, 2008 at 12:56 pm
hi,
i tried to send more than one number 92xxxxxxxx,92xxxxxxxx from send.php from using http://www.aswinanand.com/sendsms.php but the response is done invalin number and messeage does not delivered. script is is not accepting mobilenumber as uid.plz tell me how to send to more than one numbers.
October 7th, 2008 at 10:41 pm
@Tanik: Please read the blog post carefully again. ‘uid’ is the user id you created at way2sms.com. To send the same SMS to multiple numbers, you have to separate 2 or more numbers with semicolon (’;').
@Joyce: It looks like way2sms redirects its users to one of their servers dynamically after login. That doesn’t affect us though.
October 9th, 2008 at 9:06 am
You can send SMS free to Cell Phones in Argentina:
Radio Sabalera SMS
Tested and works!
October 14th, 2008 at 8:21 am
hi aswin, how r u? U told to release the Java version of the web service and also asked me to maintain the code in my own system, but what happened. I think u are busy with other works. So may i know how much time will to take for u to release it in Java version.
October 14th, 2008 at 6:59 pm
Sorry Vivin, last week was a bit tight at work. I’m thinking of doing it this weekend. Hope that’s fine.
October 15th, 2008 at 11:00 pm
Thank you aswin, take ur own time b’coz u r alone taking all the pain of doing a good job for us. Thanks a lot.
October 15th, 2008 at 11:04 pm
Aswin, when i try to send sms using the webservice by providing my mobile no. as userid, its saying invalid login but when i give my userid(mailid) instead of mobile no. its accepting and am able to send sms. I think u have made some validations (like login validations) and may I please know what all the validations or preconditions u made for the webservice.
October 16th, 2008 at 11:32 pm
Ashwin, What about the .net version? can you let me know when it will be released? so that we can maintain it.
Jp
October 17th, 2008 at 1:36 am
JP, .net library is definitely in the cards. I’m on it this weekend after barcamp. Its on the way.
Vivin, I just added login validation and phone number validation. If the user enters invalid user id or invalid password, it will be clearly shown.
October 19th, 2008 at 8:52 pm
[...] control system which was developed by Linus Torvalds. I recently signed up at GitHub to host the SMS Web Service program & this session was really very helpful in getting me started. Next session was intro to Ruby on [...]
October 30th, 2008 at 11:33 am
Hi Aswin,
i am developing a free sms portal using jsp.
but i am not getting please help me
send some javacodes related to free sms technology
regards,
Harish
November 6th, 2008 at 12:07 pm
hi,
I tried to login using the url,
http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&
pwd=__PWD__&phone=__NUMBER__&msg=__MSG__
with my way2sms user id and pass which is working in the
way2sms website.. but i got “invalid login ” i need help in getting the web service worked.plz reply
Thanks,
Muthucheliyan
November 6th, 2008 at 1:27 pm
@Muthu: I tried just now with my login ID and password. SMS is being sent properly.
November 13th, 2008 at 10:45 pm
Hi,does it work in Bangladesh?
Thanks
Om
November 13th, 2008 at 11:01 pm
Hello Om, as of now, this works only in India because way2sms supports India only.
November 18th, 2008 at 11:09 am
HI,
can i use you weservices
and http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&
pwd=__PWD__&phone=__NUMBER__&msg=__MSG__
and i copy the above URL and paste it in IE(intenet explore) but it didn’t worked out
November 18th, 2008 at 11:13 am
HI,
can i use you weservices
and http://www.aswinanand.com/sendsms.php?uid=__USER_ID__&
pwd=__PWD__&phone=__NUMBER__&msg=__MSG__
and i copy the above URL and paste it in IE(intenet explore) but it didn’t worked out
one more thing i forget to tell, after pasting the url
in the internet explorer i am getting a message it is done, but the message was not recieved by my mobile which was entered in the url
November 20th, 2008 at 4:48 pm
Thanks,
It is easily integrated in asp.net application
November 27th, 2008 at 8:47 pm
what else Mr.Aswin?
November 27th, 2008 at 8:48 pm
any progress in sms web service?
November 27th, 2008 at 8:49 pm
btw u r working on?
December 18th, 2008 at 3:49 am
Hey Aswin,
I downloaded the file that you have posted on your site and uploaded them to my web server including the .inc file (html parser) as well as the php. I even downloaded the nusoap files and added them to the server. The service works when I send a message and everything, but there is one small problem - it seems to add some slashes (’\') wherever I use single quotes in my code. And this happens only when I use the service from my server, but if I send the same exact message from your server, I don’t get that error.
As I am a complete newbie when it comes to PHP, any help you can provide me to solve this problem would be greatly appreciated.
Thanks.
Sharan
December 18th, 2008 at 6:54 am
Sharan, looks like your single quotes are being escaped. To prevent escaping, you have to URL-encode them, which is what we are doing anyway.
December 23rd, 2008 at 9:02 pm
hi aswin, how r u? can u upload the java version of the webservice so that i can maintain both the web service and the my java client program on my machine. Thanks in advance. Awaiting ur code..
December 30th, 2008 at 9:33 pm
hi aswin, Happy new year in advance. how r u? can u upload the java version of the webservice so that i can maintain both the web service and the my java client program on my machine. Thanks in advance.
December 31st, 2008 at 10:52 am
Hello Vivin, wish you the very same. The java library is on its way with the new year. I have just completed it. Will test it once and release it tomorrow.