PEAR2\Net\RouterOS export

Please tell me how to PEAR2\Net\RouterOS to get the result of command /export ?

At least in current versions, /export doesn’t return anything over the API, so you can’t just output it.

You can use the “file” argument to export to a file, and then read the file though.

e.g.

$exportFileName = 'EXPORT.rsc';

$util = new RouterOS\Util($client = new RouterOS\Client('192.168.88.1', 'admin', 'password'));

$client->sendSync($util->newRequest('export', array('file' => $exportFileName));
sleep(2);//Wait for RouterOS to write the file to disk
$export = $util->fileGetContents($exportFileName);
$util->filePutContents($exportFileName, null);//Optional; Remove the file from the router

Possible without a file? like "export " from telnet
Don’t want to write on the hdd.

Sadly, no. Not with current versions at least.

You can remove the file, as in the example above, but you do have to make the HDD write.