如何通过 mikrotik pear2 api 获得在线用户?
how to earn online user with mikrotik pear2 api?
我使用 pear2 api 断开用户与 mikrotik 的连接。
$printRequest = new RouterOS\Request('/ip/hotspot/active/print');
$printRequest->setArgument('.proplist', '.id,mac-address');
$printRequest->setQuery(RouterOS\Query::where('user', $username)->andWhere('mac-address',$macAddress));
$id = $this->client->sendSync($printRequest)->getArgument('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$this->client->sendSync($removeRequest);
现在我想用这个 api 吸引所有在线用户。请指导我。
$printRequest = new RouterOS\Request('/ip/hotspot/active/print');
$printRequest->setArgument('.proplist', 'address,user,.id');
$id = $this->client->sendSync($printRequest)->getAllOfType(RouterOS\Response::TYPE_DATA);
foreach ($id as $response) {
echo $response('.id'), '--', $response('user'), '--', $response('address'), "\n";
}
我使用 pear2 api 断开用户与 mikrotik 的连接。
$printRequest = new RouterOS\Request('/ip/hotspot/active/print');
$printRequest->setArgument('.proplist', '.id,mac-address');
$printRequest->setQuery(RouterOS\Query::where('user', $username)->andWhere('mac-address',$macAddress));
$id = $this->client->sendSync($printRequest)->getArgument('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$this->client->sendSync($removeRequest);
现在我想用这个 api 吸引所有在线用户。请指导我。
$printRequest = new RouterOS\Request('/ip/hotspot/active/print');
$printRequest->setArgument('.proplist', 'address,user,.id');
$id = $this->client->sendSync($printRequest)->getAllOfType(RouterOS\Response::TYPE_DATA);
foreach ($id as $response) {
echo $response('.id'), '--', $response('user'), '--', $response('address'), "\n";
}