Servage Magazine

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

Sending SMS to cellphones from your website

Friday, January 27th, 2012 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.

Sending SMS to cellphones from your website, 3.7 out of 5 based on 26 ratings
Categories: Tips & Tricks


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.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.