Datasheet
API PHP package
49
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>RouterOS log</title>
<style type="text/css">
table, td, th {border: 1px solid black;}
td span {outline: 1px dotted black;}
</style>
</head>
<body>
<?php
try {
$client = new RouterOS\Client('192.168.0.1', 'admin', 'password');
} catch (Exception $e) {
?><div>Unable to connect to RouterOS.</div>
<?php
}
if (isset($client)) {
?><table>
<thead>
<tr>
<th>Time</th>
<th>Topics</th>
<th>Message</th>
</tr>
</thead>
<tbody><?php
$logEntries = $client->sendSync(
new RouterOS\Request('/log print')
)->getAllOfType(RouterOS\Response::TYPE_DATA);
foreach ($logEntries as $entry) {
?>
<tr>
<td><?php echo $entry('time'); ?></td>
<td><?php
$topics = explode(',', $entry('topics'));
foreach ($topics as $topic) {
?>
<span><?php echo $topic; ?></span><?php
}
?>
</td>










