How do I read user manager End Time by php API

How do I read user manager End Time by php API

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)

I did not find this file
PEAR2/Net/RouterOS/Autoload.php

in your script

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)

ok thank you i try now