<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$subject = 'SUBJECT OF MMS';
$message = 'BODY OF MMS';
$destination = 'DESTINATION NUMBER';
function sendMMS($content) {
$ch = curl_init('http://www.smsglobal.com.au/mms/sendmms.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;
}
//Encode content to send to SMS Global
$content = 'username='.rawurlencode($username).
'&password='.rawurlencode($password).
'&number='.rawurlencode($destination).
'&message='.rawurlencode($message).
'&subject='.rawurlencode($subject).
'&max_dimension=320'.
'&smil=1'.
'&message_at_start=1';
//Encode attachments to send to SMS Global
$content .= "&attachment1=".rawurlencode(base64_encode(file_get_contents('http://www.smsglobal.com/en-au/technology/mms/SMSGlobal.gif')));
$content .= "&type1=".rawurlencode('image/gif');
$content .= "&name1=".rawurlencode('SMSGlobal.gif');
$smsglobal_result = sendMMS($content);
//Success. ID = 1335579879265695;
$explode_result = explode('Success. ID = ', $smsglobal_result);
if(count($explode_result) == 2) {
//Message Success
$smsglobal_mms_id = substr(trim($explode_result[1]), 0, -1);
echo $smsglobal_mms_id;
} else {
//Message Failed
echo 'Message Failed'.'<br />';
echo $smsglobal_result;
}
?>