我需要有关 teampeak 服务器信息的帮助。
例子:
- 服务器名称:Teamspeak 服务器
- 在线:35/100
那么,如何获取teampeak服务器信息,在线玩家数量,主机名等。
我使用 Planet Teamspeak 框架。 https://github.com/planetteamspeak/ts3phpframework
<?php
include "libraries/TeamSpeak3/TeamSpeak3.php"; // include ts3api library
try
{
// connect to server, authenticate and grab info
$ts3 = TeamSpeak3::factory("serverquery://serveradmin:password@hostname:10011/?server_port=9987");
// show server as online
echo "Server Status: Online<br />\n";
echo "Server IP: " . $ts3->getAdapterHost() . ":" . $ts3->virtualserver_port . "<br />\n";
echo "Server Uptime: " . TeamSpeak3_Helper_Convert::seconds($ts3->virtualserver_uptime) . "<br />\n";
echo "Server Version: " . TeamSpeak3_Helper_Convert::version($ts3->virtualserver_version) . "<br />\n";
echo "Current Clients: " . $ts3->virtualserver_clientsonline . " / " . $ts3->virtualserver_maxclients . "<br />\n";
}
catch(Exception $e)
{
// grab errors and show server as offline
echo "Server Status: Offline<br />\n";
}
?>
这是这个框架的简单展示,但你可以用它做更多的事情。