Visit your regional website: Clickatell Ireland Regional Website Clickatell Australia Regional Website Clickatell United Kingdom Regional Website Clickatell United States Regional Website Clickatell India Regional Website Clickatell South Africa Regional Website
  • Developer Solutions

 

   

You are here: Developer Solutions | SMS Scripts | PhP

SMS Scripts - PHP

Clickatell provides you with some ready-made scripts that are available to help you connect to our gateway through your chosen programming language. These scripts all work with the HTTP API. Sign up now and get 10 free credits to try our service.

Send SMS with PHP:

Use the PHP code below to send SMS via the Clickatell SMS Gateway. Simply register for an HTTP API account, and you will automatically receive 10 free SMS credits to try our service.

Code Sample:

<?
$user = "user";
$password = "password";
$api_id = "xxxx";
$baseurl ="http://api.clickatell.com";
$text = urlencode("This is an example message");
$to = "0123456789";
// auth call
$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
// do auth call
$ret = file($url);
// split our response. return string is on first line of the data returned
$sess = split(":",$ret[0]);
if ($sess[0] == "OK") {
$sess_id = trim($sess[1]); // remove any whitespace
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
// do sendmsg call
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
echo "success
message ID: ". $send[1];
else
echo "send message failed";
} else {
echo "Authentication failure: ". $ret[0];
exit();
}
?>

SMS Gateway sign up image

Please note that some of the above code has been supplied to Clickatell by clients. As such accuracy is not guaranteed by Clickatell.

 

       
Payment Options   Associations and Security  
Clickatell: Payment methods


Clickatell: MMA logo Clickatell: GSM Clickatell: Thawte Click to verify BBB accreditation and to see a BBB report.