From 2b6d31b6fb9ce39e989e5416a9ad917afd9ccef6 Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Tue, 21 Aug 2018 01:19:12 +0300 Subject: [PATCH] example updated --- examples/ip_address_print.php | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/examples/ip_address_print.php b/examples/ip_address_print.php index f53b7d8..e52b589 100644 --- a/examples/ip_address_print.php +++ b/examples/ip_address_print.php @@ -7,32 +7,22 @@ use \RouterOS\Config; use \RouterOS\Client; use \RouterOS\Query; -/** - * Set the params - */ -$config = new Config(); -$config->host = '192.168.1.104'; -$config->user = 'admin'; -$config->pass = 'admin'; +// Create config object with parameters +$config = + (new Config()) + ->set('host', '192.168.1.3') + ->set('user', 'admin') + ->set('pass', 'admin'); -/** - * Initiate client with parameters - */ +// Initiate client with config object $client = new Client($config); -/** - * Build query - */ +// Build query $query = new Query('/ip/address/print'); -/** - * Send query to socket server - */ +// Send query to RouterOS $request = $client->write($query); -var_dump($request); -/** - * Read answer from server - */ +// Read answer from RouterOS $response = $client->read(); var_dump($response);