<?
// HotspotL4
// A class to easily access the SOAP-based hotspot billing and accessservices
// provided by http://www.hotspotsolutions.de/
//
// Further Information on how to access this service can be found at
// http://www.hotspotsolutions.de/static/ger/info_hotspot-l4-webservice
//
// This class requires PHP-5.1 or higher and HTTPS-Support
//
// License free for any purposes
// Author, 2006, Thomas Lehner GmbH, D- 97525 Schwebheim
class Hotspot {
var $identifier = "Hotspot";
var $login;
var $password;
var $wsdl_url;
var $trace=1;
var $exceptions;
var $client;
var $debug=FALSE;
var $fault=NULL;
function Hotspot ($login, $password, $wsdl_url="http://webservice.hotspotsolutions.de/L4WebService.wsdl") {
$this->login = $login;
$this->password = $password;
$this->wsdl_url = $wsdl_url;
$this->init();
}
function init() {
ini_set("soap.wsdl_cache_enabled", "0");
$this->client = new SoapClient($this->wsdl_url,array(
"login" => $this->login,
"password" => $this->password,
"trace" => $this->trace,
"exceptions" => $this->exceptions));
}
function getConnections($code) {
$this->fault = NULL;
try {
$connections = $this->client->getConnections($code);
foreach ($connections->Connections as $connection) {
$ret[] = $this->obj2arr($connection);
}
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $ret;
}
function getTransactionsCount($period) {
$this->fault = NULL;
try {
$count = $this->client->getTransactionsCount($period);
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $count;
}
function getGatewayIsOnline($gateway) {
$this->fault = NULL;
try {
$online = $this->client->getGatewayIsOnline($gateway);
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $online;
}
function getAccount($code) {
$this->fault = NULL;
try {
$account = $this->obj2arr($this->client->getAccount($code));
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $account;
}
function createAccount($creationstring) {
$this->fault = NULL;
try {
$account = $this->obj2arr($this->client->createAccount($creationstring));
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $account;
}
function getAccounts($gateway) {
$this->fault = NULL;
try {
$accounts = $this->client->getAccounts($gateway);
foreach ($accounts->Accounts as $account) {
$ret[] = $this->obj2arr($account);
}
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $ret;
}
function getGateways() {
$this->fault = NULL;
try {
$gateways = $this->client->getGateways();
foreach ($gateways->Gateways as $gateway) {
$ret[] = $this->obj2arr($gateway);
}
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $ret;
}
function actionAccount($actionstring) {
$this->fault = NULL;
try {
$account = $this->client->actionAccount($actionstring);
} catch (SoapFault $soapFault) {
$this->fault = $soapFault;
if ($debug) printFault($this->fault);
}
return $account;
}
function printFault($fault) {
echo $fault->faultcode.":".$fault->faultstring;
}
// Helper functions
function &obj2arr($_obj, $_arr=NULL) {
if ($_arr === NULL) $_arr = array();
if ($_obj === NULL) return null;
foreach($_obj as $key => $value) {
$_arr[$key] = $value;
}
return $_arr;
}
}
?>