Community discussions

just joined
Topic Author
Posts: 1
Joined: Mon Jan 21, 2019 5:22 pm

php api script

Mon Jan 21, 2019 6:12 pm

how to get these values tx ant rx using api
interfaces > Ethernet > TX and RX
User avatar
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: php api script

Tue Jan 22, 2019 8:20 pm

Using the API client from my signature:
require_once 'PEAR2_Net_RouterOS-1.0.0b6.phar';
use PEAR2\Net\RouterOS;

$util = new RouterOS\Util(
     $client = new RouterOS\Client('', 'admin', 'password')
$monitorTrafficResponses = $client->sendSync($util->setMenu('/interface')
    ->newRequest('monitor-traffic', ['once', 'numbers' => $util->find()]));

echo '<table>';
foreach ($monitorTrafficResponses as $monitorTrafficResponse) {
    echo '<tr>';
    foreach ($monitorTrafficResponse as $prop => $value) {
        echo "<th>{$prop}</th><td>{$value}</td>";
    echo '</tr>';
echo '</table>';
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)

Who is online

Users browsing this forum: No registered users and 9 guests