<?php
    
function sendSMS($content) {
        
$ch curl_init('http://www.smsglobal.com.au/http-api.php');
        
curl_setopt($chCURLOPT_POSTtrue);
        
curl_setopt($chCURLOPT_POSTFIELDS$content);
        
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
        
$output curl_exec ($ch);
        
curl_close ($ch);
        return 
$output;    
    }

    
$username 'USERNAME';
    
$password 'PASSWORD';
    
$destination 'PHONE NUMBER';
    
$text 'SAMPLE TEXT';
    
$userfield 'UNIQUE ID';
        
    
$content =  'action=sendsms'.
                
'&user='.rawurlencode($username).
                
'&password='.rawurlencode($password).
                
'&to='.rawurlencode($destination).
                
'&text='.rawurlencode($text).
                
'&api=1'.
                
'&userfield='.rawurlencode($userfield);
    
    
$smsglobal_response sendSMS($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;    
    }
?>