\RouterOS
Mikrotik API implementation
Synopsis
class RouterOS
{
- // constants
- const DEBUG = false;
- const ATTEMPTS = 3;
- const TIMEOUT = 5;
- const DELAY = 0;
- // members
- private $socket;
- private $port;
- public boolean $connected = false;
- public $debug_str = NULL;
- public $error_str = NULL;
- public $error_num = NULL;
- // methods
- private boolean debug()
- public boolean connect()
- private string encode_length()
- private array parse_response()
- public array read()
- public boolean write()
- public array command()
- public void disconnect()
- public float determineVersion()
Constants
Name | Value |
---|---|
DEBUG | false |
ATTEMPTS | 3 |
TIMEOUT | 5 |
DELAY | 0 |
Members
private
- $port
- $socket
public
- $connected
- $debug_str
- $error_num
- $error_str
Methods
private
- debug() — Fills in the `$this->debug_str` variable if self::DEBUG is enabled
- encode_length() — Encodes length
- parse_response() — Parses RouterOS device`s reply to 'comfortable' array
public
- command() — Use it for sending commands to RouterOS device
- connect() — Establishes connection with RouterOS device via API
- determineVersion() — Tries to get RouterOS version via SNMP or from login WEB page
- disconnect() — Closes up established connection with RouterOS device
- read() — Reads data from RouterOS device via API
- write() — Writes command to RouterOS device via API