get_traffic()
Get traffic.
Signature
get_traffic(array $parameters): mixedParameters
Pass these parameters as KasRequestParams. Every request also requires kas_login, kas_auth_type, and kas_auth_data, as shown in SOAP with PHP.
| Name | Description | Requirement |
|---|---|---|
year |
The year (optional, defaults to the current year) | Optional |
month |
The month (optional, defaults to the current month) | Optional |
PHP example
<?php
// $sessionToken is returned by KasAuth, see SOAP with PHP.
$parameters = [
'year' => '2012',
'month' => '09',
];
try {
$client = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl');
$response = $client->KasApi(json_encode([
'kas_login' => 'w0123456',
'kas_auth_type' => 'session',
'kas_auth_data' => $sessionToken,
'kas_action' => 'get_traffic',
'KasRequestParams' => $parameters,
]));
print_r($response);
} catch (SoapFault $fault) {
echo 'Error: ' . $fault->faultstring;
}
Responses and error codes
-
array_returnarray with information about traffic (in bytes) and hits