4 changed files with 138 additions and 25 deletions
-
28examples/interface_print.php
-
2examples/ip_address_print.php
-
28examples/system_packag_print.php
-
105src/Client.php
@ -0,0 +1,28 @@ |
|||
<?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('user', 'admin') |
|||
->set('pass', 'admin'); |
|||
|
|||
// Initiate client with config object
|
|||
$client = new Client($config); |
|||
|
|||
// Build query
|
|||
$query = new Query('/interface/getall'); |
|||
|
|||
// Send query to RouterOS
|
|||
$request = $client->write($query); |
|||
|
|||
// Read answer from RouterOS
|
|||
$response = $client->read(); |
|||
print_r($response); |
|||
@ -0,0 +1,28 @@ |
|||
<?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('user', 'admin') |
|||
->set('pass', 'admin'); |
|||
|
|||
// Initiate client with config object
|
|||
$client = new Client($config); |
|||
|
|||
// Build query
|
|||
$query = new Query('/system/package/getall'); |
|||
|
|||
// Send query to RouterOS
|
|||
$request = $client->write($query); |
|||
|
|||
// Read answer from RouterOS
|
|||
$response = $client->read2(); |
|||
print_r($response); |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue