Skip to content
Nick Otter edited this page Jun 27, 2013 · 1 revision

Origonally from: http://wiki.mikrotik.com/wiki/API_PHP_class#Example_5

Count leases from specific IP Pool (using regexp count all IPs starting with 1.1.x.x)

###Example 5A

<?php

require_once "vendor/autoload.php";

use \RouterOS;

$API = new RouterOS\Core();

$ARRAY = $API->comm("/ip/dhcp-server/lease/print", array(
    "count-only"=> "",
    "~active-address" => "1.1.",
));

print_r($ARRAY);

###Example 5B

<?php

require_once "vendor/autoload.php";

use \RouterOS;

$API = new RouterOS\Core();

$API->write('/ip/dhcp-server/lease/print', false);
$API->write('=count-only=', false);
$API->write('~active-address~"1.1."');
$ARRAY = $API->read();

print_r($ARRAY);
Clone this wiki locally