Class example to get your balance, and to send an sms using the Clickatell API. No validation happens on the data you submit. This will need to be handled by you. (Maybe I’ll add extra code for that later)
<?php /* * EnterSolutions * @Author : Morne Oosthuizen (http://www.entersolutions.co.za) * */ class Communications { /* * Send Sms * @param $aMsgData = array(Number,Message); * @return String * */ public function SendSms($aMsgData) { $result = file_get_contents('http://api.clickatell.com/http/sendmsg?api_id='.CLICKATELL_API.'&user='.CLICKATELL_USERNAME.'&password='.CLICKATELL_PASSWORD.'&to='.$aMsgData['to'].'&text='.substr(urlencode($aMsgData['msg']),0,160)); return $result; } /* * Get available credits * * @return String * */ public function GetBalance() { $result = file_get_contents('http://api.clickatell.com/http/getbalance?api_id='.CLICKATELL_API.'&user='.CLICKATELL_USERNAME.'&password='.CLICKATELL_PASSWORD); return $result; } } ?>