";
//CONEXION A MIKROTIK
$client = new RouterOS\Client('$ip', '$username', '$password');
?>
Its something like that, but i cant connect, and i have this alert: “Fatal error: Uncaught exception ‘PEAR2\Net\Transmitter\SocketException’ with message 'stream_socket_client(): php_network_getaddresses: getaddrinfo failed: No such host is known. ’ in phar://C:/wamp/www/PEAR2_Net_RouterOS-1.0.0b4.phar/PEAR2_Net_RouterOS-1.0.0b4/src/PEAR2/Net/RouterOS/Communicator.php on line 151”
I think that API is triyng to connect without values :S
When you first open up a page, PHP runs from the start to end of the file (without any breaks) and it stops. In your browser, you then eventually submit a form that again executes everything from start to end, without any recollection of what happened during any previous requests.
You’d need to use sessions (here’s a tutorial and another one) to in essence, create a dedicated login form, which would store the entered credentials into the session. You can then retrieve those session values from $_SESSION, and fill in the constructor with them. It should go without saying that you can of course modify those later, but the point is to store & retrieve them, so that they’re remembered for a while once entered.