Make a print request with a query that matches the item you want to remove/disable/set. Part of the response will be the “.id” of that item. Pass that to the “numbers” argument of a new remove/disable/set command.
tnx but This code does not work.
i upload PEAR2_Net_RouterOS in CPanel Host and use this code.
in this code i don’t need REMOTE_ADDR, and I just determine use a PHP variable $ for, set the ID.
You need an ID. Using a number won’t work. The “numbers” argument in MikroTik’s API, ironically enough, doesn’t accept numbers as its Winbox counterpart. You MUST use an ID, and you can get the correct ID with a print request, as in the example above.
If you want to disable a specifc IP (as opposed to $_SERVER[‘REMOTE_ADDR’]), you can hardcode the IP itself onto the query, i.e.
$id = $client->sendSync(
new Request('/ip/socks/access/print .proplist=.id', null, Query::where('address', '3.3.3.3'))
)->getArgument('.id');