Page 1 of 1

API - PHP

Posted: Fri Aug 11, 2017 4:40 pm
by Jefte
Hello guys , i have this command -> /interface wireless access-list print count-only where interface=wlan2 ... and this work fine in command line.
but i try do this in API with lib php.

$API->write('/interface/wireles/access-list/print',false);
$API->write('=count-only=',false);
$API->write('=where=',false);
$API->write('=interface=wlan2');

returning this error -> array(1) { ["!trap"]=> array(1) { [0]=> array(1) { ["message"]=> string(17) "unknown parameter" } } }

anyone can help ? Sorry about my english.

Re: API - PHP  [SOLVED]

Posted: Fri Aug 11, 2017 4:57 pm
by mrz
What you are trying to do is not possible. Use queries instead
https://wiki.mikrotik.com/wiki/Manual:API#Queries

Re: API - PHP

Posted: Fri Aug 11, 2017 7:04 pm
by Jefte
Thanks ,

$API->write('/interface/wireles/access-list/print',false);
$API->write('=count-only=',false);
$API->write('=where=',false);
$API->write("?interface=$wlan");

Now , works so fine.