I am trying to change the timeout as the current seems to be taking ages to establish that it cant establish an api link could someone help with this?
catch (Exception $e) {
}
I am trying to change the timeout as the current seems to be taking ages to establish that it cant establish an api link could someone help with this?
catch (Exception $e) {
}
Although you haven’t shown much of your current code, the one line you’ve shown leads me to believe you are using my client. Assuming so…
It’s at the 6th argument, the 5th being whether or not the connection should be a persistent one.
If it takes you ages to make a connection, you might find it useful to make the connection a persistent one, e.g.
new RouterOS\Client('hostname', 'username', 'password', null, true);
That way, once the connection is established, it will be kept for subsequent PHP requests, making your application run more smoothly after the first PHP request. This is a little more taxing on the web server, but significantly less so than if EVERY PHP request takes ages to complete otherwise.
Or, if you insist on just changing the timeout:
new RouterOS\Client('hostname', 'username', 'password', null, false, 10);
(will give up connecting after 10 seconds)