Community discussions

MikroTik App
nihatkusneli
刚刚加入了
Topic Author
Posts: 2
加入: Fri Apr 13, 2018 7:55 am

RouterOs Api Script

Fri Mar 29, 2019 8:10 am

Hi,
In the following figure, the script I wrote via routeros api gives an error. What's the right way?
Code:Select all
$API->write('/ip/hotspot/cookie/remove'); $API->write('=user=155548745'); $OKU=$API->read(false); $ARRAY = $API->parseResponse($OKU); print_r ($ARRAY); Error Code : [code][!trap] => Array ( [0] => Array ( [message] => no such command prefix ) )
Thanks...
Top
用户头像
BlackVS
Member Candidate
Member Candidate
Posts: 171
加入: Mon Feb 04, 2013 7:00 pm
Contact:

再保险:l雷竞技RouterOs美联社i Script[SOLVED]

Wed Apr 03, 2019 12:01 pm

Try remove by id not by name.
In terminal of WinBox
Code:Select all
/ip hotspot cookie remove ?
I see
Remove specified item (or several items).
-- List of item numbers
i.e. very probably it needs numbers i.e. I think ids, something like
Code:Select all
$API->write('=.id=*ABCDEF');
Sure you need find value of field ".id" for required user first...
In terminal it is command like:
Code:Select all
:put [/ip hotspot cookie find user="155548745"]
Or try condition:
Code:Select all
$API->write('?=user=155548745');
From API docs unclear if this work in such way
Top
nihatkusneli
刚刚加入了
Topic Author
Posts: 2
加入: Fri Apr 13, 2018 7:55 am

再保险:l雷竞技RouterOs美联社i Script

Sat Sep 07, 2019 9:57 pm

Thanks...
Top

Who is online

Users browsing this forum:syahendrarecaand 9 guests