Community discussions

MikroTik App
 
User avatar
progjuliano
just joined
Topic Author
Posts: 7
Joined: Thu Sep 25, 2008 10:16 pm

Remove active user hotspot - PHP API

Thu Sep 25, 2008 10:20 pm

Hello,

I'm Juliano,

I'm from Brazil,

with the PHP API, I can make this:

$API->write("/ip/hotspot/active/remove", false);

$API->write("=.id=*137010A");

$API->read();


in Winbox, I can make this:

/ip hotspot active>remove [find user=test]


I wanted remove active user, for user, using PHP API,

do you can help me ?

Sorry for my little english.

Thanks.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Thu Sep 25, 2008 11:40 pm

there's no analogue of 'find' in API. you should list all entries and then remove necessary item
 
User avatar
progjuliano
just joined
Topic Author
Posts: 7
Joined: Thu Sep 25, 2008 10:16 pm

Re: Remove active user hotspot - PHP API

Fri Sep 26, 2008 12:08 am

I need remove active user hotspot for PHP API, but passing the user name and not id, do you understand?
thanks !
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Fri Sep 26, 2008 1:37 am

exactly. you should '/ip/hotspot/active/print', then find necessary ID for your user name, and then remove that ID
 
User avatar
progjuliano
just joined
Topic Author
Posts: 7
Joined: Thu Sep 25, 2008 10:16 pm

Re: Remove active user hotspot - PHP API

Fri Sep 26, 2008 5:16 pm

It's a ideia, but when try to list all user with print, never get all.

I did like to make this:

$API->write("/ip/hotspot/active/remove", false);
$API->write("=.id=[find user=user1]");

but do not work.

or type:

$API->write("/ip/hotspot/active/find", false);
$API->write("=where=user=user1]");

also do not work.

an another solution, did could to be the your suggestion, but if get all users of true.


:(
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Fri Sep 26, 2008 9:32 pm

'/ip/hotspot/active/print'
did you see that? did you tried it? I think, no...

there's no 'find' in API!
 
User avatar
progjuliano
just joined
Topic Author
Posts: 7
Joined: Thu Sep 25, 2008 10:16 pm

Re: Remove active user hotspot - PHP API

Fri Sep 26, 2008 10:35 pm

$API->write("/ip/hotspot/active/print");

>>> [3] !re
>>> [13] =.id=*10A040A
>>> [15] =user=locolimpe
>>> [18] =address=10.4.10.1
>>> [18] =uptime=1d03:19:40
>>> [29] =session-time-left=5d20:40:20
>>> [24] =idle-timeout=1d12:00:00
>>> [3] !re
>>> [13] =.id=*137010A
>>> [12] =user=cebola
>>> [18] =address=10.1.55.1
>>> [16] =uptime=00:01:56
>>> [29] =session-time-left=6d23:58:04
>>> [24] =idle-timeout=1d12:00:00
>>> [3] !re
...

this I already did test, the problem is that nor always it comes all, do you know why?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Fri Sep 26, 2008 11:31 pm

if you think it's a bug - write to support@mikrotik.com
 
User avatar
progjuliano
just joined
Topic Author
Posts: 7
Joined: Thu Sep 25, 2008 10:16 pm

Re: Remove active user hotspot - PHP API

Sat Sep 27, 2008 12:00 am

thanks very much :D
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Sat Sep 27, 2008 12:53 am

you are welcome =)
 
bokad
Member Candidate
Member Candidate
Posts: 152
Joined: Tue Oct 18, 2005 7:34 pm

Re: Remove active user hotspot - PHP API

Tue Jan 20, 2009 9:27 pm

I have something like the below where I am using the API to get a list of all hotspot active users and then selecting a single user ID to call with remove. This does not work though. It lists the users and the ID is a valid one but it does not log that person out. Is hotspot remove supported in the API?

$API->write('/ip/hotspot/active/print',true);
$READ = $API->read(true);

$API->write('/ip/hotspot/active/remove',false);
$API->write('=.id=*C0A82306',true);
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Wed Jan 21, 2009 9:55 am

hmmm...

0xC0A82306 is IP address 192.168.35.6... just a coincidence, or you are confusing something?..
 
User avatar
cholegm
Frequent Visitor
Frequent Visitor
Posts: 57
Joined: Thu Jul 19, 2007 7:43 pm
Location: Gornji Milanovac, Serbia
Contact:

Re: Remove active user hotspot - PHP API

Wed Apr 15, 2009 1:57 pm

Same question.

I need to disconnect some user from my administration page "Active users".
And when I say remove .id=(calculated line id number - same as telnet line id) or .id=(id from API print)...
No error and nothing happens.

Problem is maybe in API. If I understand .id must be same as line id from telnet. If not... there is no way to do something like this.
$userid = -1;

foreach ($ARRAY as $value) {
	$userid = $userid + 1;
	if ($value['user'] == $_GET['kill']) {
		$API->write('/ip/hotspot/active/remove',false);
		$API->write('.id=' . $value['.id']);
		//$API->write('.id=' . $userid);
		$KILL = $API->read();
	}

Does anyone find solution?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Wed Apr 15, 2009 2:00 pm

I think it should be $API->write('=.id=' . $value['.id']);
 
User avatar
cholegm
Frequent Visitor
Frequent Visitor
Posts: 57
Joined: Thu Jul 19, 2007 7:43 pm
Location: Gornji Milanovac, Serbia
Contact:

Re: Remove active user hotspot - PHP API

Wed Apr 15, 2009 2:15 pm

It working!!!


Thanks very much!!!

You have a beer :D
 
123abolfazl
just joined
Posts: 1
Joined: Sat Apr 28, 2018 12:27 pm

Re: Remove active user hotspot - PHP API

Sat Apr 28, 2018 12:32 pm

hello
i'm abolfazl
how to disable hotspot server with api microtik php
help me?????????????????????????????????????????????????
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Remove active user hotspot - PHP API

Tue May 01, 2018 1:55 pm

How do you do it with Terminal? :)

Who is online

Users browsing this forum: ChadRT and 113 guests