Page 1 of 1
How do I read user manager End Time by php API
Posted: Tue Jul 17, 2012 9:17 am
by tact1982
How do I read user manager End Time by php API
Re: How do I read user manager End Time by php API
Posted: Tue Jul 17, 2012 8:44 pm
by boen_robot
I assume you mean the session's "till-time"? I mean, I can't find anything closer to that...
Using my client (see my signature), you can do it like so:
<?php
namespace PEAR2\Net\RouterOS;
require_once 'PEAR2/Net/RouterOS/Autoload.php';
$client = new Client('192.168.0.1', 'admin', 'password');
header('Content-Type: text/plain');//This is just to get nice text formatting...
foreach ($client->sendSync(new Request('/tool user-manager session print'))->getAllOfType(Response::TYPE_DATA) as $response) {
echo 'User: ', $response->getArgument('user'), "\nEnd time: ", $response->getArgument('till-time'), "\n\n";
}
(assuming you want this for all users)
Re: How do I read user manager End Time by php API
Posted: Thu Jul 19, 2012 3:24 am
by tact1982
I did not find this file
PEAR2/Net/RouterOS/Autoload.php
in your script
Re: How do I read user manager End Time by php API
Posted: Thu Jul 19, 2012 1:30 pm
by boen_robot
From my signature, you can download an archive (there's a TGZ and ZIP versions; both are equivalent, so it doesn't matter which of the two you get). All files, including Autoload.php, are in the "src" folder of the archive. Extract all files from that folder somewhere, and adjust the path in the script above so that it points to Autoload.php.
(I'm going to release a new version soon, that will contain everything within a single .phar file that will be require_once'd directly... hopefully, that will make things easier)
Re: How do I read user manager End Time by php API
Posted: Fri Jul 20, 2012 12:08 am
by tact1982
ok thank you i try now