Closed ArturVidal closed 4 years ago
And which error @ArturVidal ? There is usually an error message above the stack trace. Without this, nobody can help you.
[18-May-2020 22:24:28 Europe/Lisbon] PHP Fatal error: Uncaught TeamSpeak3_Transport_Exception: Connection timed out in /home/arturvid/public_html/scripts/banner/libraries/TeamSpeak3/Transport/TCP.php:55 Stack trace:
thrown in /home/arturvid/public_html/scripts/banner/libraries/TeamSpeak3/Transport/TCP.php on line 55
Looks like as you're trying to connect to an URI, which is not reachable. Please double-check your URI: Host, Port, Protocol
It's always recommend to use try-catch
to avoid such errors:
<?php
// load framework files
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
// register custom error message (supported placeholders are: %file, %line, %code and %mesg)
TeamSpeak3_Exception::registerCustomMessage(0x300, "The specified channel does not exist; server said: %mesg");
try
{
// connect to local server, authenticate and spawn an object for the virtual server on port 9987
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:password@127.0.0.1:10011/?server_port=9987");
// spawn an object for the channel using a specified name
$ts3_Channel = $ts3_VirtualServer->channelGetByName("I do not exist");
}
catch(TeamSpeak3_Exception $e)
{
// print the error message returned by the server
echo "Error " . $e->getCode() . ": " . $e->getMessage();
}
I have a error on file TCP.php