<?php
function sendSMS($content) {
$ch = curl_init('http://www.smsglobal.com.au/http-api.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);
curl_close ($ch);
return $output;
}
$username = 'USERNAME';
$password = 'PASSWORD';
$destination = 'PHONE NUMBER';
$source = 'FROM NAME';
$text = 'SAMPLE TEXT';
$schedule = '2010-12-25 15:00:00'; //25th December 2010, 3pm.
$content = 'action=sendsms'.
'&user='.rawurlencode($username).
'&password='.rawurlencode($password).
'&to='.rawurlencode($destination).
'&to='.rawurlencode($source).
'&text='.rawurlencode($text).
'&scheduledatetime='.rawurlencode($schedule);
$smsglobal_response = sendSMS($content);
//Sample Response
//SMSGLOBAL DELAY MSGID:21021064
$explode_response = explode('SMSGLOBAL DELAY MSGID:', $smsglobal_response);
if(count($explode_response) == 2) { //Message Success
$smsglobal_schedule_id = $explode_response[1];
//SMSGlobal Message ID
echo $smsglobal_schedule_id;
} else { //Message Failed
echo 'Message Failed'.'<br />';
//SMSGlobal Response
echo $smsglobal_response;
}
?>