USA: +1 650 641 0011 
South Africa: +27 21 910 7700 
 
  Buy Now | My Account | Contact Us  
developer main image
 

SYSTEMS WARNING ALERT: The database D:\Program Files\... has reached its maximum size of 16383 MB. Event ID: 1174 - 03/07/2007 03:42pm

 
  • 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 trial the 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 trial the 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.

 

 

Messaging Solutions
Personal Users
Small Business
Enterprise
Your Industry

About Us
Newsroom
Industry Affiliations
Investor Information
Privacy Policy
Terms
No Spam
Careers @ Clickatell
White Papers and Guides
Why Clickatell
Contact Us
Access To Information

Developers
Developer API
HTTP/S
SMPP
SMTP
FTP
XML
Com Object
SMS Scripts
Promote your Application

Products
Clickatell Gateway
SMS Gateway
Two-way SMS
Shortcode SMS Messaging
ICM
Test our Gateway
Wholesale
Multimodal Messaging
Communicator
Messenger-PRO

Partners
Strategic Partners
System Integrators
Messenger-PRO
Affiliates
Commission Junction

Pricing & Coverage
Message Costs
Basic Coverage
Advanced Coverage
Shortcode Costs
Two-way Costs
ICM Costs
How do i pay?

Support
FAQ
Downloads
Guides
Forums
Contact Us

Customers
Engineering
Entertainment
Financial Services
Internet & ECommerce
IT & Software
Marketing & Promotions
Non Profit & Government
Retail
Travel & Tourism