hi my firends
i have problem using phprouterOS API
i want use this command:
/ip hotspot active remove numbers=[/ip hotspot active find where user=username]
i use comm in routerOS with this structure but did not work.
mikrtoik->comm('/ip/hotspot/active/remove/numbers=[/ip/hotspot/active/find/where/user=username]');
my mikrotik os version 5.26
please help me.
thanks a lot.
I am guessing you didn’t read anything about how the MikroTik API works at all. If you are gonna be using the API, I suggest you give the manual page a read before continuing.
You can find it here: wiki.mikrotik.com/wiki/Manual:API
There is no nested commands in the API. But you can make it query for a specific entry somewhat.
You will have to first do a print command to get the ID of the item you want to delete, then you need to do a second command using the returned ID from the first command.
I don’t know the PHP syntax, but this is how the API commands will be at least:
/ip/hotspot/active/print
=.proplist=.id
?user=<username>
And then save the returned ID and use it in a second call:
/ip/hotspot/active/remove
=.id=<id>