Datasheet
RouterOS PHP class
161
•• static function connect($host, $login, $password, $port = 8728, $timeout = 5)
Connects to new RouterOS using specified "host" with specified "login" and "password" on "port".
$conn = RouterOS::connect("192.168.10.11", "admin", "adminpassword");
•• public function setTimeout($timeout = 5)
Set socket timeout in seconds.
$conn->setTimeout(10);
• function dispatch(&$continue)
Dispatches comming messages from server to functions executed as callbacks. Returns TRUE if there is one or more
pending functions.
continue - flag to manually break listener loop (it can be done from callback). Initial value should be set to TRUE.
$continue = TRUE; $conn->dispatch($continue);
•• function getall($cmd, $proplist = FALSE, $args = array(), $assoc = FALSE, $callback = FALSE)
Get all values for specified command. Returns array of results.
cmd - name of command (string or array)
proplist - list of values to get (string comma delimeted or array)
args - additional arguments, ie. queries (string space delimeted or associative array)
assoc - name of associative key
$conn->getall("/interface/wireless/registration-table");
Array
(
[0] => Array
(
[.id] => *2
[interface] => ap11
[mac-address] => 00:1F:1F:XX:XX:XX
[ap] => true
[wds] => true
[rx-rate] => 11Mbps
[tx-rate] => 11Mbps
[packets] => 237069,179718
[bytes] => 210614627,28263429
[frames] => 237069,179718
[frame-bytes] => 209210987,27185121
[hw-frames] => 289168,179718
[hw-frame-bytes] => 262600082,31498353
[tx-frames-timed-out] => 0
[uptime] => 1d11:00:24
[last-activity] => 00:00:04.950
[signal-strength] => -62dBm@1Mbps
[signal-to-noise] => 29
[strength-at-rates] => -62dBm@1Mbps 20ms,-61dBm@11Mbps 2m20s690ms










