PEAR2 \ Net \ Transmitter \ SocketException:stream_socket_client():无法连接(连接被拒绝)由mikrotik

When i tried to connect mikrotik, it work in local but server it refused connection.

Below i gave my code

try {
    $client = new RouterOS\Client('192.168.1.1','test','test','8728'); 
    echo 'OK'; 
 } catch (Exception $e) { 
    die($e); 
 }

After so much tried cannot solved. At last found that may be it is server firewall issue. Then alternative found a solution.

  1. Change mikrotik ip/services api port 8728 to 2703 or 2089.
  1. try { $client = new RouterOS\Client('192.168.1.1','test','test','2703'); echo 'OK'; } catch (Exception $e) { die($e); }

Finally, it's working