Rayger_X
Member
- Sep 12, 2015
- 36
- 20
- 43
TeamSpeak 3 PHP Framework - Download
PHP:
<?php
// load framework library
require_once("path/libraries/TeamSpeak3/TeamSpeak3.php"); // path to teamspeak framework
// data logging
$ts3_login="login"; // Login
$ts3_password="password"; // Password
$ts3_host="IP_adres"; // Server IP adress
$ts3_queryport="10011"; // query port (default 10011)
$ts3_voiceport="9987"; // voice port (default 9987)
try{
// connect to server, authenticate and grab info
$ts3_connect = TeamSpeak3::factory("serverquery://$ts3_login:$ts3_password@$ts3_host:$ts3_queryport/?server_port=$ts3_voiceport");
// variable
$server_status = $ts3_connect->virtualserver_status;
$server_name = $ts3_connect->virtualserver_name;
$server_adress = $ts3_connect->getAdapterHost();
$server_uptame = TeamSpeak3_Helper_Convert::seconds($ts3_connect->virtualserver_uptime);
$server_actuallyusers = $ts3_connect->virtualserver_clientsonline - $ts3_connect->virtualserver_queryclientsonline;
$server_maxusers= $ts3_connect->virtualserver_maxclients;
$server_channels = $ts3_connect->virtualserver_channelsonline;
$server_download = TeamSpeak3_Helper_Convert::bytes($ts3_connect->connection_filetransfer_bytes_received_total + $ts3_connect->connection_bytes_received_total);
$server_upload = TeamSpeak3_Helper_Convert::bytes($ts3_connect->connection_filetransfer_bytes_sent_total + $ts3_connect->connection_bytes_sent_total);
// show server as online
echo "<table>";
echo "<tr>";
echo "<td>Server Status:</td><td class='server_online'>$server_status</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Server Name</td><td class='server_name'>$server_name</td>" ;
echo "</tr>";
echo "<tr>";
echo "<td>Server Adress:</td><td class='server_adress'>$server_adress</td>" ;
echo "</tr>";
echo "<tr>";
echo "<td>Server Uptime:</td><td class='server_uptame'>$server_uptame</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Users:</td><td class='server_users'>$server_actuallyusers/$server_maxusers slotów</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Channels:</td><td class='server_channels'>$server_channels</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Download:</td><td class='server_download'>$server_download</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Upload:</td><td class='server_upload'>$server_upload</td>";
echo "</tr>";
echo "</table>";
}
// check error
catch(Exception $e){
echo "<p class='server_error'> ERROR: </p>" , $e->getMessage(), "\n";
}
?>