You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
pasha d89dcb69ab small fixes, readme update 7 years ago
examples initial release 7 years ago
src small fixes, readme update 7 years ago
.gitignore initial release 7 years ago
.scrutinizer.yml code sniffer config added 7 years ago
LICENSE license added, composer file updated 7 years ago
README.md small fixes, readme update 7 years ago
composer.json license added, composer file updated 7 years ago

README.md

RouterOS PHP7 API Client

composer require evilfreelancer/routeros-api-php

Small example

Get all IP addresses, analog via command line is /ip address print

<?php
require_once __DIR__ . '/vendor/autoload.php';

error_reporting(E_ALL);

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';

/**
 * Initiate client with parameters
 */
$client = new Client($config);

/**
 * Build query
 */
$query = new Query('/ip/address/print');

/**
 * Send query to socket server
 */
$request = $client->write($query);
var_dump($request);

/**
 * Read answer from server
 */
$response = $client->read();
var_dump($response);

You can simplify your code and write then read from socket in one line:

$response = $client->write($query)->read();
var_dump($response);