Send SMS Message Using Clickatell API - Part 6

Written on September 29, 2007 – 12:48 am | by Michael Boateng |

The last part of the tutorial is using the callback url feature of the clickatell api. This feature allows the Clickatell gateway to forward message status details of the sms message you sent back to your server, through the url you provided on your control panel. This is quite tricky but its simple.

All you have to do is to log on to clickatell’s control panel, and choose the api_id you want to set your callback url.
The insert the url, eg. www.mboateng.com/callback.php.

Create a file “callback.php” on your server and paste the code below.

What will happen is that, any time you send an SMS Message to Clickatell’s gateway, it will forward the response in a url form to which ever url you will provide as your callback url.

callback.php

<?php
//**************************************************
//
// Send SMS Message Using Clickatell API - Part 6
// 23rd September 2007
// www.mboateng.com
// Michael Ofori Amanfo Boateng
//
//**************************************************

require_once(’settings.php’);

// Declare variables for url string
$url = $_SERVER[’QUERY_STRING’];

$api_id = $_GET[’api_id’];
$from = $_GET[’from’];
$to = $_GET[’to’];
$text = $_GET[’text’];
$dated = $_GET[’timestamp’];
$apiMsgId = trim($_GET[’apiMsgId’]);
$status = $_GET[’status’];
$charge = $_GET[’charge’];

mysql_select_db($database_conn, $conn);
$sql = “update tbl_outbox set url=’$url’, status = ‘$status’, charge = ‘$charge’ where apimsgid = ‘$apiMsgId’”;
$result = mysql_query($sql, $conn) or die(mysql_error());

mysql_free_result($rsOutbox);
?>

Download Tutorial >>

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

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 :