Audibase Recording App Banner

Lost?

Have an account? Register |

Samuel East

 

First in last out?

 


Send a text message using Clickatell API

Ok so today i am going to show you how to send a text message using clicktells api system.

First things first setup a clicktell account. You can do this here Clicktells Central Developers API Solution

Make sure that you select the correct country the you are based and wish to send texts from else it won’t work. I have selected the UK.

Activate you account from throguh the email sent by clicktell.

Login and then you will be asked to send an activaton code to the number that you provided when setting up your account.

It will be in a similar format to this “5b08909d”.

Ok great now you should be in central home and have an option to buy sms credits etc.

In the bottom left column their should be an option to Click here to create a connection (API ID)

I selected HTTP API as this is the option we will be using but i maight cover so others.

It will now show you your API ID “3274000″.

So it generates the following code.

user=isimpledesign
password=<Clickatell Account Password>
api_id=3274000
to=<Mobile Number(s)> (comma separated)
text=<SMS Message>

And it also gives you an example string.

http://api.clickatell.com/http/sendmsg?user=isimpledesign&password=PASSWORD&api_id=3274000&to=447702220559&text=Message

Ok now for and example just to check that everything is up and running copy the example string and paste into a new browser window and run.

Ok you should get the following errors
ERR: 001, Authentication failed

Ok this is fine and easy to solve if you look at the string you will see that the password varibale is set to PASSWORD.

user=isimpledesign&password=PASSWORD&api_id=3274000&to=447732220559&text=Message

Ok just enter the password that you set your account up with and run again and you should now recieve a text message.

Ok great no lets setup a simple form and then intergrate clicktells system.

Navigate to this page and grab some dummy code Clicktell Script.

Here is the script.

<?
$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();
}
?>

You can test the example here.

Tags: , , ,

Leave a Reply


 

Wordpress Plugin Development

Currently we have been working on Wordpress plug-in development having the ability to create custom plug-in for our clients is great as we can now tailor them specifically. View More »

Titanium Mobile
App Development

Here at iSimpleDesign we take SEO and Website management very seriously as we are always striving to be at the top off our game, keeping ahead off the competition.

Content Management Systems

We offer an wide range off CMS systems Wordpress and Joomla to name a few, with a CMS you will be able to manage all you content and users etc... View More »

 

www.isimpledesign.co.uk, all rights reserved.

  • Clients

  • CRM

  • Design

  • Development

  • General

  • SEO