Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Send SMS from your website

Tuesday, March 24th, 2009 by Servage

smsgatewayDo 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

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.

Send SMS from your website, 3.7 out of 5 based on 56 ratings
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

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??

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“.

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?

Defining an own sending number has ben heavily abused, so therefore the gateway does no longer support that.

@ 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 – provides a full SMS HTTP API with the ability to set the originator name/number.

Our SMS partner does not allow to do that in an automated fashion, so unfortunately we cannot incorporate that just now :-(

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!

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: ‘’-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.

We are aware that this is not optimal for everyone and are already looking into changing this.

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


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:

// $numbers is an array of all recipient numbers
// $text is a string containing the message
foreach ($numbers AS $number) {
  sendSMS($number, $text);

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.

Would such a script be open to attack and abused?

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.

What happens if someone replies to the SMS, particularly with the words ‘stop’ or ‘unsubscribe’?

The gateway is one-way. Replies are not processed.

Is it possible to recieve sms?

The gateway is one-way at the moment, meaning you can just send SMS.

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?

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

LOL 5 free SMS

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.

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).

When does it work to danish mobile phones?

It works with all networks and operators in Denmark: Orange, Sonofon, TDC, Tele2, Telia, Tellmore, Three.

Any network coverage in Iceland?

The following networks are covered in Iceland: Landssimi (Siminn), Nova, Vodafone (Islandssimi), TAL and Viking Wireless (IMC).

This is such a good idea

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


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.

I have been using 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!

great site – added to my vinyl favourites list for sure – do you use twitter?

this seems like it would be a very interesting blog to keep up with. Please visit my business and fashion jewelry blog when you have time.

Well…..I agree with most of the things you said. Anyway, thanks!

Thanks very much for your interesting post. Will be back in the future.

very nice information thnx!

I really liked your blog!

I use it, nice but expensive..

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.

You activate the API in the controlpanel and menu Mobile Services -> HTTP API and then you can use the API’s

This is really great. I am happy to see all the information. Now we can send sms in our own web site.


I would love to do this but is it only for a techi to manage?

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 and try out, you wont break anything.

thank you

good job

How I can send SMS with arabic language?

Can you provide more information on this?

Great blog. Thanks for the interesting article. Will send others your way.

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 ???

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,

I really liked your blog!

Some good information in your post. Thanks for the pleasant read!

good information. thanks

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.

Superb code. Thanks for sharing

i want paid sms service on my site

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.

It is working too good

Sent on a phone using

Please advise as to whether Pennsylvania USA is covered by your SMS gateway.


Most networks worldwide are covered by the gateway. You can check a specific number in the control panel:

i want to make my site to sent sms

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.

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.

thank you. I like it. this is amazing.

hey, stumbled on your site and put your script on my site….works a treat!!!! Thanks Dude

hey just added the script to my site……works a treat!!;)

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

ohh I didn’t know about the whole php script part, sweet

Now you make it easy for me to understand and implement the concept. Thank you for the post.

Thank you for your article about how to use the Servage SMS gateway with a PHP script.

I understand and thank you for this article

Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also…

Hi i used this code in our site but it shows error like missing customer id, number. Please help me to solve this problem.

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.

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

I also enjoying reading it.
How much it is going to cost if website sends sms to various counties.


Current pricing is available in the control panel.

I do love your blog.

can i test this with out having a websit

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.

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

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…

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.

Send SMS from your website is great post

Leave a comment

You must be logged in to post a comment.