首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何利用mikrotik pear2 api获得在线用户?

如何利用mikrotik pear2 api获得在线用户?
EN

Stack Overflow用户
提问于 2017-05-01 06:44:00
回答 1查看 1K关注 0票数 0

我使用pear2 api将用户与mikrotik断开连接。使用

代码语言:javascript
复制
$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。请引导我。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-01 12:42:39

代码语言:javascript
复制
 $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";
 }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43715339

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档