Send SMS Message Using Clickatell API - Part 1

Written on September 23, 2007 – 3:34 am | by Michael Boateng |

I have been receiving numerous emails on how to send SMS Messages using Clickatell’s HTTP API with a PHP script. I have therefore designed this tutorial to send a simple sms message using clickatell’s HTTP API.

This tutorial basically solves three things.

1. Send a simple sms message on clickatell’s sms gateway using HTTP
2. Retrieve the apimsgid of a message and stores it in a mysql table
3. Use the callback url to check the status of an sms message

Before you start, make sure the following have been done.

1. Register at Clickatell for your account.

2. Register for an HTTP API account at your clickatell control panel. Once you create and HTTP API account, you will be assigned the following. (username, password and api_id) wich you will insert in your script.

3. Whilst on the HTTP API control panel, assign the callback url. Eg. www.mysite.com/callback.php

Once all these are settle we will create our mysql table

Mysql Tables

CREATE TABLE `tbl_outbox` (
`messageid` bigint(10) NOT NULL auto_increment,
`sender` varchar(20) default NULL,
`recipient` varchar(20) default NULL,
`status` varchar(50) default ‘008′,
`apimsgid` varchar(50) default NULL,
`charge` decimal(5,2) default ‘0.00′,
`timesent` varchar(50) default NULL,
`message` tinytext,
`dated` varchar(30) default NULL,
PRIMARY KEY (`messageid`)
) TYPE=MyISAM;

Note:
//Sender: Stores the phone number of the sender
//Receipient : stores the number of the recipient
//Status: I use this to store the the status of the text message
//Apimsgid: this stores the apimsgid of the text message
//Timesent: this is the timestamp on of the message when its sent
//Message: stores the message you are sending
//Dated: its something I just use to show when I sent it from the site

Download Tutorial >>

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  1. 2 Responses to “Send SMS Message Using Clickatell API - Part 1”

  2. By Remco on Sep 24, 2007 | Reply

    Can I see your code working on a website? I want to setup a sms-website but really need some technical advice

  3. By Lord Fader on Dec 7, 2007 | Reply

    Can you integrade the code solution
    youre posting here in THIS website
    maybe with only 1 sms free or whatever
    to see how the code is working ???
    THX for your effort
    Greetz

Post a Comment

About This Blog

Welcome to the Official Blog of Michael Ofori Amanfo Boateng [www.mboateng.com], an online blog resource for all web designers Ghana. There will be tutorials on Ajax ,ASP, ASP.NET, C#, CFML, Flash, JavaScript, PHP, Python (125) and Ruby on Rails. More

Want to subscribe?

 Subscribe in a reader Or, subscribe via email:
Enter your email address:  
Find entries :