
Api php template
132
Api php template
This is a php template for working with RouterOS v3 API.
Requirements
1. It uses the php api Class found here : link API_PHP_class
[1]
.
2. It is presented first in the forum here link Forum_link
[2]
3. overLIB popup JavaScript library is required for this and its included in the files (zip file) or can be found here:[3]
Connected Clients (from the registration table)
<?php
require('routeros_api.class.php');
$API = new routeros_api();
$API->debug = false;
if ($API->connect('192.168.1.2', 'api', 'api1234')) { // Change this as necessery
$API->write('/interface/wireless/registration-table/print',false);
$API->write('=count-only=');
$READ = $API->read(false);
$ARRAY = $API->parse_response($READ);
echo "Number of connected clients:" . substr($READ[1],5);
$API->disconnect();
}
?>
Resources (cpu/mem/disk/version)
<?php
require('routeros_api.class.php');
$API = new routeros_api();
$API->debug = false;
Comentários a estes Manuais