Page 1 of 1

Login to hotspot using API

Posted: Wed Dec 27, 2017 8:52 pm
by drudge
I am trying to login in mikrtotik hotspot using api with no sucess.

Code: Select all

$this->router->write('/ip/hotspot/active/login',true);
$this->router->write('=user=user',false);
$this->router->write('=password=password',false);
$this->router->write('=mac-address=DC:0B:34:CA:52:C6 ',false);
$this->router->write('=ip=192.168.88.249',false);
$read = $this->router->read(false);
$array = $this->router->parseresponse($read);
var_dump($array)
I am getting the response below:

Code: Select all

<<< [24] /ip/hotspot/active/login
<<< [12] =user=user
<<< [18] =password=password
<<< [30] =mac-address=DC:0B:34:CA:52:C6
<<< [18] =ip=`192.168.88.249`
>>> [5/5] bytes read.
>>> [5, 53]!trap >>> [11/11] bytes read.
>>> [11, 41]=category=4
>>> [32/32] bytes read.
>>> [32, 8]=message=unknown host IP 0.0.0.0
>>> [5/5] bytes read.
>>> [5, 1]!done array(1) { ["!trap"]=> array(1) { [0]=> array(2) { ["category"]=> string(1) "4" ["message"]=> string(23) "unknown host IP 0.0.0.0" } } }
Disconnected...
When i tried to do it from winbox. It is working fine but while trying it from api i am getting the unknown host 0.0.0.0 .

Re: Login to hotspot using API

Posted: Sun Aug 25, 2019 8:47 am
by mankomal
Was wondering if you were able to get this done as I am also struck in the same thing.