<?php
function sendWAP($content) {
$ch = curl_init('http://www.smsglobal.com/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;
}
$user = 'USERNAME'; //SMSGlobal Username
$password = 'PASSWORD'; //SMSGlobal Password
$to = 'PHONE NUMBER'; //WAP Destination
$from = 'SMSGlobal'; //FROM Name / Number
$url = 'http://www.smsglobal.com/'; //WAP PUSH
$subject = 'SMSGlobal Website'; //Web URL Name
//Encode content and send to SMS Global
$content = 'action=sendsms'.
'&msgtype=wappush'.
'&user='.rawurlencode($user).
'&password='.rawurlencode($password).
'&to='.rawurlencode($to).
'&from='.rawurlencode($from).
'&url='.rawurlencode($url).
'&subject='.rawurlencode($subject);
$smsglobal_response = sendWAP($content);
//Sample Response
//OK: 0; Sent queued message ID: 04b4a8d4a5a02176 SMSGlobalMsgID:6613115713715266
$explode_response = explode('SMSGlobalMsgID:', $smsglobal_response);
if(count($explode_response) == 2) { //Message Success
$smsglobal_message_id = $explode_response[1];
//SMSGlobal Message ID
echo $smsglobal_message_id;
} else { //Message Failed
echo 'Message Failed'.'<br />';
//SMSGlobal Response
echo $smsglobal_response;
}
?>