Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 1.47 KB

README.md

File metadata and controls

78 lines (54 loc) · 1.47 KB

RouterOS API

About

Installation

###Composer

Incorperate the following to your composer.json file

"repositories": [
    {
        "type": "git",
        "name": "tnoc/routeros",
        "url": "http://github.com/TNOC/routeros_api"
    }
],
"require": {
    "tnoc/routeros": "dev-master"
}

Then update your dependencies: php composer.phar update

Usage

Example index.php

<?php

require_once "vendor/autoload.php";

use \RouterOS;

$api = new RouterOS\Core();

if ($api->connect('111.111.111.111', 'LOGIN', 'PASSWORD')) {

   $api->write('/interface/getall');

   $READ = $api->read(false);
   $ARRAY = $api->parse_response($READ);

   print_r($ARRAY);

   $api->disconnect();

}

Executables

###./bin/routeros-test.php

RouterOS Test is a script to test that a Mikrotik is accessable through API

Usage:

  • php ./bin/routeros-test.php --help
  • php ./bin/routeros-test.php -h 111.111.111.111 -u username

Examples

Examples are from http://wiki.mikrotik.com/wiki/API_PHP_class