<?php
error_reporting
(E_ALL & ~ E_DEPRECATED);

require_once(
'./NuSoap/lib/nusoap.php'); //Download NUSoap from SourceForge // http://sourceforge.net/projects/nusoap/

$s_client = new nusoap_client('http://www.smsglobal.com/mobileworks/soapserver.php?wsdl''wsdl');

$s_error $s_client->getError();

if(
$s_error) {    //Print Error
    
echo '<pre>';
    
print_r($s_error);
    echo 
'</pre>';
    exit;
}

$s_param = array(
                
'user'            => 'USERNAME',
                
'password'        => 'PASSWORD'
                
);


$result $s_client->call('apiValidateLogin'$s_param'http://www.smsglobal.com/mobileworks/soapserver.php');

$s_error $s_client->getError();

if(
$s_error) { //Print Error
    
echo '<pre>';
    
print_r($s_error);
    echo 
'</pre>';
    exit;
}

/**
Response, need to decode
<?xml version="1.0" encoding="UTF-8" ?><resp err="0"><ticket>489754f17ceaf162sr4a749d5ar23c7b</ticket></resp><pre>
**/

$xml_praser xml_parser_create();

xml_parse_into_struct($xml_praser,$result,$xml_data,$xml_index);
xml_parser_free($xml_praser);

$ticket_id $xml_data[$xml_index['TICKET'][0]]['value'];


$s_param = array(
                
'ticket'        => $ticket_id,
                
'sms_from'        => 'SMSGlobal',  //Use for two way messages - Otherwise use a Sender ID
                
'sms_to'         => '61447100250'//Destination number
                
'msg_content'     => 'Hello World'//Message content
                
'msg_type'         => 'text',
                
'userfield'        => 'ABC123'//Userfield, we push this back to your server on 2way reply
                
'unicode'         => '0',
                
'schedule'         => '0'
                
);

$result $s_client->call('apiSendSms'$s_param'http://www.smsglobal.com/mobileworks/soapserver.php');

$s_error $s_client->getError();

if(
$s_error) { //Print Error
    
echo '<pre>';
    
print_r($s_error);
    echo 
'</pre>';
    exit;
}

$xml_praser xml_parser_create();

xml_parse_into_struct($xml_praser,$result,$xml_data,$xml_index);
xml_parser_free($xml_praser);

print_r($xml_data);

echo 
'SMSGlobal Message ID: '$xml_data[$xml_index['MSGID'][0]]['value']
?>