Location: PHPKode > scripts > Hotspot > hotspot/example.php
<?
// HotspotL4 - Examples
// 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
//
// The class requires PHP-5.1 or higher and HTTPS-Support
//
// License free for any purposes
// Author, 2006, Thomas Lehner GmbH, D- 97525 Schwebheim


include "Hotspot.php";

$service = new Hotspot("myusername", "mypassword");



/* Get the gateways(hotspots) for this service */
$gateways = $service->getGateways();
foreach ($gateways as $gateway) {
	echo $gateway['uid'].":".$gateway['name']."\n";
}
/* Example output
U43676060:hotspot_test1
U43676061:hotspot_test2
*/


/* Get the connections for a given code */
$connections = $service->getConnections("gi1wftkqh7cx");
foreach ($connections as $connection) {
	echo $connection['start'].":".$connection['stop'].":".$connection['last_updated']."\n";
}
/* Example output
1152726208:1152730637:1152730637
1152811007:1152812277:1152812277
*/


/* Is a gateway(hotspot) defined by it's UID online or offline */
$online = $service->getGatewayIsOnline("U43676060");
if($online) echo "online"; else echo "offline";
/* Example output
online
*/


/* Get the information for an account defined by it's code */
$account = $service->getAccount("gi1wftkqh7cx");
print_r($account);
/* Example output
Array
(
    [code] => gi1wftkqh7cx
    [online_status] => 0
    [acc_attr] =>
    [acc_mode] => time
    [acc_ctime] => 1148580244
    [acc_atime] => 1152726221
    [acc_ltime] => 1152985405
    [acc_rtime] => -96
    [acc_fulltime] => 18000
)
*/


/* Get all accounts for a gateway(hotspot) defined by it's UID */
$accounts = $service->getAccounts("U43676060");
foreach ($accounts as $account) {
	echo $account['code'].":".$account['online_status'].":".$account['acc_rtime']."\n";
}
/* Example output
obmv6cp07hgt:0:-7
mp0hrcp2efvp:0:-11
1x1w4b2xvdz2:0:-62
*/


/* Create an account. The parameters are defined by a string(UID:<mode>:qouta) */
$account = $service->createAccount("U43676060:timewindow:1d");
print_r($account);
/* Example output
Array
(
    [code] => i2xuq12w7pk1
    [online_status] => 0
    [acc_attr] =>
    [acc_mode] => timewindow
    [acc_ctime] => 1168047329
    [acc_atime] => 0
    [acc_ltime] => 0
    [acc_rtime] => 86400
    [acc_fulltime] => 86400
)
*/

/* Perform an action on an account defined by an actionstring(code:<lock|disconnect|delete>) */
$account = $service->actionAccount("gi1wftkqh7cx:lock");


/* Get the transactions made over this service in a defined period */
$transactionsCount = $service->getTransactionsCount("today");
echo $transactionsCount."\n";
/* Example output
110
*/

?>
Return current item: Hotspot