Example #1
0
 <body>

 <?php 
$wsdl = "https://www.regonline.com/api/default.asmx?wsdl";
$client = new SoapClient($wsdl, array("trace" => 1, "exceptions" => 0, "cache_wsdl" => 0));
// Login
$result = $client->Login(array("username" => "<USERNAME>", "password" => "<PASSWORD>"));
// Get the API Token
$apiToken = $result->LoginResult->Data->APIToken;
// Setup the SOAP Header
$authHeader = new AuthHeader();
$authHeader->APIToken = $apiToken;
$header[] = new SoapHeader('http://www.regonline.com/api', 'TokenHeader', $authHeader, false);
$client->__setSoapHeaders($header);
// Makes the call to GetEvents
$events = $client->GetEvents(array("filter" => 'Title.Contains("Testing")', "orderBy" => ""));
// TODO: Do something with the results
// Class for passing the APIToken
class AuthHeader
{
    var $APIToken;
    function __construct()
    {
    }
}
?>

<h2>PHP SOAP Test</h2>
<p>
	This is a sample demonstration of calling the RegOnline API using the PHP SoapClient. It first calls the Login method to get the API Token 
	and then passes the token to the GetEvents method via a SOAP Header.