i am trying to write a project, where it fetches all the data from the api via /log/print result.. and stores it on a table in php format.
i can output the log now.. but i would like to update it every 5seconds or so, so it could fetch utomaticaly the new logs, but i am kind of lost here..
this is the logging code php
Code: Select all
if ($API->connect($mikrotik_ip, $mikrotik_username,$mikrotik_password)) {
$log = $API->comm("/log/print");
$clog = count($log);
$a=0;
$a<=$clog;
$a++;
$syslog = $log[$a]["message"]."<br>";
} ?>
then i am printing it on a PHP table
Code: Select all
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Log</th>
</tr>
</thead>
<tbody>
<tr scope="row">
<?php
echo "<tr>";
echo "<td bgcolor=''></td>";
echo "<td>" . $syslog . "</td>"
?>
</tbody>
</table>
</div>
</div>
output result
now i need it to update every 5 seconds.. but i am kind of lost http refresh? every 5 seconds? or via script? or is there any better option for real live logging from log/print console to output in php table or form?