-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
33 lines (26 loc) · 969 Bytes
/
Copy pathindex.php
File metadata and controls
33 lines (26 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require('../credentials.php');
require('../../vendor/autoload.php');
use Mukhin\AjaxSystemsApi\AjaxSystemsApiClient;
use Mukhin\AjaxSystemsApi\Exception\Exception;
$ajaxSystemsClient = new AjaxSystemsApiClient();
try {
$ajaxSystemsClient->login(AJAX_SYSTEMS_LOGIN, AJAX_SYSTEMS_PASSWORD);
$ajaxSystemsClient->getCsaConnection();
$logs = $ajaxSystemsClient->getRawLogs(AJAX_DEFAULT_HUB_ID, 4, 0);
foreach ($logs as $log) {
// Division by 1000 move dot between unix time and microseconds
$dateTime = DateTime::createFromFormat('U.u', $log['time'] / 1000);
echo sprintf(
"%s. Event with code #%s raised at object %s (#%s at HUB %s) at %s\n",
$log['id'],
$log['eventCode'],
$log['objName'],
$log['hexObjectId'],
$log['hexHubId'],
$dateTime->format('Y-m-d H:i:s.u')
);
}
} catch (Exception $e) {
echo $e->getMessage();
}