i used pear2 api for disconnect user from mikrotik. with
$printRequest = new RouterOSRequest('/ip/hotspot/active/print'); $printRequest->setArgument('.proplist', '.id,mac-address'); $printRequest->setQuery(RouterOSQuery::where('user', $username)->andWhere('mac-address',$macAddress)); $id = $this->client->sendSync($printRequest)->getArgument('.id'); $removeRequest = new RouterOSRequest('/ip/hotspot/active/remove'); $removeRequest->setArgument('numbers', $id); $this->client->sendSync($removeRequest);
now i want get all online user with this api. please guide me.
Advertisement
Answer
$printRequest = new RouterOSRequest('/ip/hotspot/active/print'); $printRequest->setArgument('.proplist', 'address,user,.id'); $id = $this->client->sendSync($printRequest)->getAllOfType(RouterOSResponse::TYPE_DATA); foreach ($id as $response) { echo $response('.id'), '--', $response('user'), '--', $response('address'), "n"; }