Thanks for your help with the debug code. Here is the error message (I obfuscated my personal details):
Client not created because of the following exception: exception 'PEAR2\Net\Transmitter\SocketException' with message 'Failed to initialize socket.' in /srv/disk8/xxxxxxx/www/mysubdomain.myhost.net/PEAR2/Net/Transmitter/TcpClient.php:109 Stack trace: #0 /srv/disk8/xxxxxxx/www/mysubdomain.myhost.net/PEAR2/Net/Transmitter/TcpClient.php(93): PEAR2\Net\Transmitter\TcpClient->createException('Failed to initi...', 7) #1 /srv/disk8/xxxxxxx/www/mysubdomain.myhost.net/PEAR2/Net/RouterOS/Communicator.php(110): PEAR2\Net\Transmitter\TcpClient->__construct('myexternalIP', 8728, false, NULL, 'api_user', NULL) #2 /srv/disk8/xxxxxxx/www/mysubdomain.myhost.net/PEAR2/Net/RouterOS/Client.php(105): PEAR2\Net\RouterOS\Communicator->__construct('myexternalIP', 8728, false, NULL, 'api_user', NULL) #3 /srv/disk8/xxxxxxx/www/mysubdomain.myhost.net/test11.php(11): PEAR2\Net\RouterOS\Client->__construct('myexternalIP', 'api_user', 'api_user_password') #4 {main} Socket error number:111 Socket error message:Connection refused
Alos here is the list of functions that are supposedly disabled for free users on my host:
The following PHP functions are disabled on free accounts due to system/security reasons: allow_url_fopen, fsockopen, pfsockpen, getrusage, get_current_user, set_time_limit, getmyuid, getmypid, dl, leak, listen, chown, chgrp, realpath, link, exec, passthru, curl_init.
I verified that the router is accessible and the API service is enabled and listening on port 8728 and I opened the port in the firewall. Do you think this happens because of limitations from my hosting site? Should I try another one?
To answer the question in your previous post: yes I do know that I have to use the external IP of the router, and I created a user with limited privileges and a strong password for the purpose. I just used the example of your code to avoid posting my IP and user names all over the forum.