all i want is simple command /print log or /print arp or /print interface
how can i do it in php?
i saw this code but i don't know did i do it correctly
<?php
use PEAR2\Net\RouterOS;
// require_once 'pear2\src\PEAR2\Autoload.php';
require_once 'PEAR2_Net_RouterOS-1.0.0b4.phar';
//IP MIKROTIK //Usuario //Password
$client = new RouterOS\Client('ip', 'user', 'pass'); //Connect a Mikrotik
// Tabla
echo "<table align='center' border='1' bordercolor='black'><form action='' method='POST'>";
echo "<tr bgcolor='#D8D8D8'><td align=left size=3>Number</td><td align=left size=3>MAC-Address</td><td size=3>Name</td><td align=left size=3>IP</td><td align=left size=3>Address</td></tr>";
//Actualizar pagina
echo "<meta http-equiv='refresh' content='2'>";
$interfaces = $client->sendSync(new RouterOS\Request('/interface/ethernet/print'));
$arps = $client->sendSync(new RouterOS\Request('/ip/arp/print'));
if ($interfaces['name']==$arps['name']) {
foreach (array_combine($interfaces, $arps) as $interface => $arp) {
if ($interface->getType() === RouterOS\Response::TYPE_DATA OR $ethernet->getType() === RouterOS\Response::TYPE_DATA ) {
$id = $interface('.id');
$id2 = $arp ('.id');
echo "<tr>";
echo "<td>". $interface('name') ."</td>";
echo "<td>". $interface('type'). "</td>";
echo "<td>". $interface('MAC-Address'). "</td>";
echo "<td>". $ppp('') ."</td>";
echo "<td><input type='submit' value='Reiniciar' name='Reiniciar' /></td></tr>";
}
}
}
echo "</form></table>"
?>