Browse Source

more examples added

tags/0.4
Paul Rock 7 years ago
parent
commit
725d971be8
  1. 25
      examples/export.php
  2. 4
      examples/system_package_print.php

25
examples/export.php

@ -0,0 +1,25 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
error_reporting(E_ALL);
use \RouterOS\Config;
use \RouterOS\Client;
use \RouterOS\Query;
// Create config object with parameters
$config =
(new Config())
->set('host', '192.168.1.3')
->set('pass', 'admin')
->set('user', 'admin');
// Initiate client with config object
$client = new Client($config);
// Build query
$query = new Query('/export');
// Send query and read answer from RouterOS
$response = $client->write($query)->read(false);
print_r($response);

4
examples/system_packag_print.php → examples/system_package_print.php

@ -18,11 +18,11 @@ $config =
$client = new Client($config);
// Build query
$query = new Query('/system/package/getall');
$query = new Query('/system/package/print');
// Send query to RouterOS
$request = $client->write($query);
// Read answer from RouterOS
$response = $client->read2();
$response = $client->read();
print_r($response);
Loading…
Cancel
Save