php code
<?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('xxx.xxx.xxx.xxx, 'admin', 'admin'); //Conexion a Mikrotik // Tabla echo "<table align='center' border='1' bordercolor='black'><form action='' method='POST'>"; echo "<tr bgcolor='#D8D8D8'><td align=left size=3>Nombre</td><td align=left size=3>Servicio</td><td size=3>Tiempo Activo</td> <td align=left size=3>Direccion</td><td align=left size=3>Reiniciar</td></tr>"; //Actualizar pagina echo "<meta http-equiv='refresh' content='2'>"; $interfaces = $client->sendSync(new RouterOS\Request('/interface/pppoe-server/print')); $ppps = $client->sendSync(new RouterOS\Request('/ppp/active/print')); if ($interfaces['name']==$ppps['name']) { foreach (array_combine($interfaces, $ppps) as $interface => $ppp) { if ($interface->getType() === RouterOS\Response::TYPE_DATA OR $ppp->getType() === RouterOS\Response::TYPE_DATA ) { $id = $interface('.id'); $id2 = $ppp ('.id'); echo "<tr>"; echo "<td>". $interface('name') ."</td>"; echo "<td>" . $interface('service'). "</td>"; echo "<td>" . $interface('uptime'). "</td>"; echo "<td>". $ppp('address') ."</td>"; echo "<td><input type='submit' value='Reiniciar' name='Reiniciar' /></td></tr>"; } } } echo "</form></table>" ?>This time, i need a list with ppp active connections, service, uptime, address, and a reboot connection button.
I think, i need combine 2 print arrays(pppoe-server and active ppp), but dont print nothing :S
And i don know how to reboot the active connection with API.
Thanks