Community discussions

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

php api script

Mon Jan 21, 2019 6:12 pm

hi
how to get these values tx ant rx using api
interfaces > Ethernet > TX and RX
 
User avatar
boen_robot
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:
<?php
require_once 'PEAR2_Net_RouterOS-1.0.0b6.phar';
use PEAR2\Net\RouterOS;

$util = new RouterOS\Util(
     $client = new RouterOS\Client('192.168.88.1', '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