Do you know how easy it is to send SMS from your website?
It can be integrated in minutes and offers a wide range of advantages for you and your users. It could be used to send information, notifications, updates and more to your users. It’s only limited by your imagination.
Servage Hosting offers an SMS gateway that you can use to send SMS with. You simply add SMS credits to your Servage account and integrate the SMS sending functionality on your site. This could for example be done within a short time with the ready-to-run scripts available in the control panel.
This article features two examples of how to use the Servage SMS gateway with a PHP script.
» Download the full sample code (ready-to-run)
Example 1: Send SMS from PHP script
// Send SMS $number = 12345678; $text = 'Hi John, how are you?'; $sms_api_result = sendSMS($number, $text); // Check if SMS was sent if ($sms_api_result[0] == 'OK') { // Ok, SMS received by the API echo 'The SMS was sent.'; } else { // Failure, SMS was not sent // In this example we display the response to identify the error print_r($sms_api_result); }
It is also possible to ask our system if the desired recipient number is covered by our SMS gateway. It covers over 700 networks in over 200 countries, so almost all numbers worldwide are covered :-)
Example 2: Check coverage of a given number
// Check coverage $number = 12345678; $sms_api_result = coverageQuery($number); // Check if recipient number is covered if ($sms_api_result[0] == 'OK') echo 'The number is covered. You can send to this recipient.'; else echo 'This number is not covered. You cannot send to this recipient.';
You can read more about the SMS gateway in the Servage control panel. Please notice our API documentation for implementation in your own code.
84 comments (leave a comment)
This is such a good idea.
I hope to try this on my site soon. There is no pricing information on this post. Are the sms messages free??
Reply by Jakob Jensen (Servage) on March 24, 2009 at 22:29
You get a bunch of free SMS to test/play with. The price for additional SMS depend on your currency and volume. You can see them in the control panel under “Mobile Services > Purchase Credits“.
by Dave So on March 24, 2009 at 17:22
There used to be a feature that allowed you to specify the name/number the SMS was sent from. This would allow customers etc to reply to the messages.
This function has been removed, will it return at some point?
Reply by Jakob Jensen (Servage) on March 25, 2009 at 07:03
Defining an own sending number has ben heavily abused, so therefore the gateway does no longer support that.
by Simon on March 25, 2009 at 02:07
@ Jakob re SMS sender number – Why not just implement a system which sends a text to the requested sender number which the recipient must reply to in order to validate the number. That way I don’t see how the system could be abused as the sender would still be effectively a real mobile phone?
A company called AQL – http://www.aql.com provides a full SMS HTTP API with the ability to set the originator name/number.
Reply by Jakob Jensen (Servage) on March 25, 2009 at 14:53
Our SMS partner does not allow to do that in an automated fashion, so unfortunately we cannot incorporate that just now :-(
by Adam Williams on March 25, 2009 at 13:09
I have probably been looking around online for like the last 20 minutes for a site like yours. So i just want to give you a big thank you and tell you too keep up the hard work. Have a great weeken! =) Thank you!
by Lookup Reverse on March 28, 2009 at 22:09
I could really use this feature, but…
Running a test, sending an SMS to my own mobil I can see that the sender / replynumber / header is named ‘Servage’.
Messaging (with customers) rely on proper identification of the sender.
I am sure that my customers would be pretty confused, thinking ‘who is Servage?’ and then delete the SMS.
Having the ‘misuse of sending own number’ in mind, would it be possible to develop a solution where I can choose from sending the ordinary ‘Servage’-header OR the sending domain, ex: ‘mydomain.com’-header instead?
Having this choice, it would be possible for me to send an SMS with a meaningful header-information without compromising the identification of the sender.
Reply by Jakob Jensen (Servage) on April 1, 2009 at 18:51
We are aware that this is not optimal for everyone and are already looking into changing this.
by Claus Rye on April 1, 2009 at 10:30
1. I notice this service is not available for mobile numbers in China. Will this change?
2. With an API application, how many sms can be sent simultaneously. Let’s say I have a list of 500
Cheers
Reply by Jakob Jensen (Servage) on April 1, 2009 at 18:48
1) There is support for the following chinese networks (country code +86): China Mobile, China Telecom and China Unicom.
2) You can send as many SMS at the same time as you like. If you do wish to send many, I suggest something like this (PHP example), using our example-scripts:
by Mitch on April 1, 2009 at 16:30
Hi!
What about making the sendes number or text be your domain names? and you could choose from a dropdown box. That way, i´ll get the option to choose my senders text, customized to my domain name, and servage will not have any abuse problem, or atleast a very low one.
by steve on April 1, 2009 at 21:03
Would such a script be open to attack and abused?
Reply by Jakob Jensen (Servage) on April 2, 2009 at 19:12
If you were to implement a SMS script on your website, you should make sure that it cannot be abused. Obviously an open/insecure SMS script can drain your SMS credits really fast, so it is in your best interest to avoid that. This could be done by protecting it behind a login mechanism or similar.
by thp-search on April 2, 2009 at 16:55
What happens if someone replies to the SMS, particularly with the words ‘stop’ or ‘unsubscribe’?
Reply by Jakob Jensen (Servage) on April 7, 2009 at 12:27
The gateway is one-way. Replies are not processed.
by Raymond Theakston on April 7, 2009 at 09:50
Is it possible to recieve sms?
Reply by Jakob Jensen (Servage) on April 7, 2009 at 12:26
The gateway is one-way at the moment, meaning you can just send SMS.
by Rick Fry on April 7, 2009 at 10:58
This is cool, but an even cooler option where to make this a payment solution for you site costumers. like they send text 20 and that goes to your credits… and an option for us to make the credits to money again?
by Øyvind on April 7, 2009 at 12:10
If it would be possible to have my site name as the sender ID I’d use this option all the time – I administer a music portal and would send people invitations for events & parties. Please make it possible :D
by Branimir on April 7, 2009 at 13:08
LOL 5 free SMS
by face on April 7, 2009 at 18:30
I am new to PHP, can you give further instruction on how to setup this SMS in my web site or on my html page? Thanks.
Reply by Jakob Jensen (Servage) on April 8, 2009 at 07:24
Well, if you want to create a SMS form like in our control panel, I suggest you look at the HTML code there. You can pretty much copy the concept. The form values then have to be submitted to your SMS sending script (PHP). Be careful: Running an “open” SMS form on your website will most likely be abused and your credits will be used up fast! It should be secured by login or similar (unless you explicitly want everyone to be able to send something).
by Merle on April 7, 2009 at 23:02
When does it work to danish mobile phones?
Reply by Jakob Jensen (Servage) on April 8, 2009 at 07:22
It works with all networks and operators in Denmark: Orange, Sonofon, TDC, Tele2, Telia, Tellmore, Three.
by Joen Seider on April 8, 2009 at 00:08
Any network coverage in Iceland?
Reply by Jakob Jensen (Servage) on April 11, 2009 at 15:57
The following networks are covered in Iceland: Landssimi (Siminn), Nova, Vodafone (Islandssimi), TAL and Viking Wireless (IMC).
by Garðar K on April 9, 2009 at 12:25
This is such a good idea
by majed on April 11, 2009 at 22:53
dear friends, just i istall the function and de php code for send a message to friend that live in NY, but this application not work and shows this error
Array ( [0] => ERROR [1] => Missing valid customer ID [2] => Missing valid secret key; ) Array ( [0] => ERROR [1] => Missing valid customer ID [2] => Missing valid secret key; )
probably i need some login and password?, i am using the same of my controlpanel,
let me know what i need, help me please
Fredy
Reply by Per Strömqvist (Servage) on April 14, 2009 at 12:58
In order to utilize the SMS API you have to enable this from the control-panel. Once done you can send SMS by making simple GET request to the gateway script. Enable the API from the menu “Mobile Services” or raise a support-ticket and a Supporter can assist you.
by fredy on April 12, 2009 at 14:42
I have been using tmppl.com. They have a website widget that I just copied and pasted into my website. Customers are directed to the site where they can join my group. Then I send out a text to all the members of my group! Its cheap too $5 per month. They keep up with the database. Take care of people wanting to opt-out on their website. Works great!
by Blake on May 8, 2009 at 21:05
great site – added to my vinyl favourites list for sure – do you use twitter?
by Glen Baildon on May 22, 2009 at 10:27
this seems like it would be a very interesting blog to keep up with. Please visit my business and fashion jewelry blog http://www.wholesalesarong.com/blog/ when you have time.
by CORRINNE on May 22, 2009 at 22:44
Well…..I agree with most of the things you said. Anyway, thanks!
by anti wrinkle skin cream on May 29, 2009 at 05:26
Thanks very much for your interesting post. Will be back in the future.
by anti wrinkle skin cream on May 29, 2009 at 06:51
very nice information thnx!
by Orkun on May 29, 2009 at 07:29
I really liked your blog!
by Jorge Reis on June 6, 2009 at 14:10
I use it, nice but expensive..
by flower on June 8, 2009 at 17:46
where should I register to use this script ?
I am getting this error when I used to send it from my site.
Array ( [0] => ERROR [1] => Missing valid customer ID [2] => Missing valid secret key; )
From where I can get customer Id and secret key?
please reply.
thanks in advance.
Reply by Per Strömqvist (Servage) on June 23, 2009 at 06:35
You activate the API in the controlpanel and menu Mobile Services -> HTTP API and then you can use the API’s
by Sankar on June 23, 2009 at 04:42
This is really great. I am happy to see all the information. Now we can send sms in our own web site.
Thanks
by Glowtouch Technologies on June 24, 2009 at 13:42
I would love to do this but is it only for a techi to manage?
Reply by Per Strömqvist (Servage) on June 29, 2009 at 07:59
We try to feed our blog with information to accommodate all our customers. This one do require a certain level of coding awareness. But do not hesitate to try. Set up a sub-domain like test.yourdomain.com and try out, you wont break anything.
by lee on June 26, 2009 at 21:22
thank you
by Ahmed on July 21, 2009 at 12:27
good job
by NANI on July 28, 2009 at 17:22
How I can send SMS with arabic language?
by Tarek Mardoud on August 3, 2009 at 19:36
Can you provide more information on this?
by wholesale rhinestones on August 9, 2009 at 19:35
Great blog. Thanks for the interesting article. Will send others your way.
by bowtie on August 10, 2009 at 03:13
I have tried this but its giving “Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\manohar\sms_api.php on line 14″ error. What should i do ???
by daniel on September 14, 2009 at 11:53
Hi I used this code in my site.It is producing error like missing coustermerID ,Number .Could you please give the idea how to get out from this error.I saw above posts for this error but tell me how should I activate mobile service and HTTP Api in my site…
Thanks In Advance,
sree
by sree on October 2, 2009 at 12:40
I really liked your blog!
by morison dony on October 21, 2009 at 16:27
Some good information in your post. Thanks for the pleasant read!
by male escort service on January 7, 2010 at 02:27
good information. thanks
by avatar on January 11, 2010 at 14:42
I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.
by Ben 10 Games on April 23, 2010 at 11:41
Superb code. Thanks for sharing
by Sniper on September 30, 2010 at 14:04
i want paid sms service on my site
Reply by Jakob Jensen (Servage) on October 19, 2010 at 10:09
You can use one-way SMS messaging (you send to people) via the Servage SMS gateway. For two-way messaging (people can send SMS to your website/script) you need a different kind of SMS service. A quick search for SMS gateway online can help you along.
by akash on October 17, 2010 at 07:06
It is working too good
—
Sent on a phone using T9space.com
by Nikhilesh on October 22, 2010 at 02:04
Please advise as to whether Pennsylvania USA is covered by your SMS gateway.
Thanks.
Reply by Jakob on November 2, 2010 at 11:17
Most networks worldwide are covered by the gateway. You can check a specific number in the control panel: https://secure.servage.net/cp/tools/sms_gateway
by test on October 30, 2010 at 23:14
i want to make my site to sent sms
by Bhavik on November 26, 2010 at 18:22
Adding SMS to a website may attract some traffic but would it be worth the cost. It also opens up issues like privacy and security. I am not so sure about this, maybe its just because my site has no apparent use for it. Let me think about it.
by Find A Person on January 19, 2011 at 15:34
Excellent idea mixing the two, blog or website and sms, these are both powerful media. The internet and sms will soon enjoy better integration as the future of mobile technology is steadily blurring the lines between the two.
by Adam Horowitz on February 21, 2011 at 18:58
thank you. I like it. this is amazing.
by fishing on March 10, 2011 at 08:20
hey, stumbled on your site and put your script on my site….works a treat!!!! Thanks Dude
by Local Mobile Monopoly on March 17, 2011 at 02:10
hey just added the script to my site……works a treat!!;)
by Local Mobile Monopoly on March 17, 2011 at 02:11
Oh this will come in handy, I have been searching for a method to integrate sms messages to my blog.
Thanks Jakob for this inspiring idea, my visitors will definite love this feature
by Tim Donovan on March 20, 2011 at 22:01
ohh I didn’t know about the whole php script part, sweet
by Best Heapdhones on March 26, 2011 at 19:36
Now you make it easy for me to understand and implement the concept. Thank you for the post.
by cheap nike shoes on April 8, 2011 at 03:00
Thank you for your article about how to use the Servage SMS gateway with a PHP script.
by nikeairus on April 15, 2011 at 02:31
I understand and thank you for this article
by tory burch boots on April 20, 2011 at 10:19
Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also…
by tory burch shoes on April 24, 2011 at 06:19
Hi i used this code in our site but it shows error like missing customer id, number. Please help me to solve this problem.
Reply by Jakob on May 5, 2011 at 09:51
The code is just an example. It may not reflect changes in the API since the article was written. Please check the newest instructions int he control panel.
by dhanya on May 3, 2011 at 12:16
I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work it
by toryburchoutletnew on May 24, 2011 at 08:41
I also enjoying reading it.
How much it is going to cost if website sends sms to various counties.
Thanks
Mark
Reply by Jakob on May 31, 2011 at 20:54
Current pricing is available in the control panel.
by Mark on May 30, 2011 at 22:45
I do love your blog.
by Mark on May 30, 2011 at 22:46
can i test this with out having a websit
by vijay on June 2, 2011 at 10:33
Amazing. How great technology is. SMS on your website will help a lot and will give you updates instantly, The process is easy to understand and the steps are clear. Thanks for the information.
by Alureon on June 29, 2011 at 01:28
Excellent weblog here! Additionally your site quite a bit up fast! What web host are you the use of? Can I am getting your affiliate hyperlink on your host? I desire my website loaded up as quickly as yours lol
Reply by Jakob on July 21, 2011 at 13:08
We’re getting a lot of spam posts, but this one is just so funny, that I couldn’t help but to release it :-) what host are you with? haha…
by cheap nike shoes on July 7, 2011 at 10:03
Hey nice blog, simply looking round some sites, appears a a very nice theme you are using. I’m presently using Drupal for a few of my sites but seeking to switch one of them over to a look very much like yours as a trial run.
by Maritza Galbiso on July 13, 2011 at 04:36
Send SMS from your website is great post
by nike sneakers on October 10, 2011 at 07:29