Search code examples
phpteamspeak

TeamSpeak Server Status and info


I have a teamspeak server and I would like to show the server status (online, offline)and the number of clients are connect in a webpage (in PHP). Could you help me please ?

I dont have serverquery my provider dont give it to me!


Solution

  • Your Provider won't give you the Query, but there is actually another Query, that you can use only for your "virtual" Server.

    It is pretty simple, because everything you need, you already have. I will just give you a Step Tutorial:

    • Connect to your Teamspeak Server with your "Admin Identity"
    • On the Top Menu click on "Tools" => "ServerQuery Login"
    • In the appeared Window you type in your Queryname, like "php"
    • Then it gives you a Password, and that's basicly it

    After this simple steps you have a Query Login, but ask your Provider if he may whitelist your Webserver's IP to use it without limits!

    You can use the Query Login as normal in PHP Scripts, like this:

    # Include Teamspeak Framework
    include "libraries/TeamSpeak3/TeamSpeak3.php";
    
    # Connect to Server
    $yourserver = TeamSpeak3::factory("serverquery://php:PHKFokBB@127.0.0.1:10011/?nickname=Epic+PHP+Query&server_port=9988");
    

    Remember: the Script is just an Example, not tested, that should be edited and worked into your Project.

    Reference: Teamspeak 3 PHP Framework