PHP code example of imafaz / mikrolink

1. Go to this page and download the library: Download imafaz/mikrolink library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

imafaz / mikrolink example snippets




use MikrotikApi\MikroLink;

$router = new MikroLink;

$router->connect('192.168.1.1', 'admin', 'password', 8728, false);

$response = $router->exec('/interface/print');

var_dump($response); //print array response

$router->disconnect();

$router = new MikroLink( int $timeout = 1,  int $attempts = 3,int  $delay = 0,$logFile = 'mikrolink.log',$printLog = false);

$router->connect(string $ip, string $username, string $password, int $port, $ssl = false);

$router->exec(string $command, array $params = null);

$router->disconnect();