Simple PHP TeamSpeak 3 Status

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
I have teamspeak 3 servers [1server]->[Xvirtual_server] how can i count all slots? used and free slots? Thanks!
$ts3->virtualserver_clientsonline / $ts3->virtualserver_maxclients
px: 5 / 32 => That means 5 slots used from max slots (32 in this case)
 

AnDrIx

Member
Oct 25, 2016
1
0
33
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";
}
?>


Hey, can you tell why deleted information about author script ?
I wrote it about two years ago, as I was learning php, creating this script as a large project to study

Here is this script.
http://andrix.pl/simple-php-teamspeak-3-status/
 

NeveRHooD_

New Member
Nov 29, 2016
1
0
13
hi
how i can ger informations of a ts3 server without queryaccount , i have no account and i want to get max client , status and ...
 

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
Hello guys, where I can find my login and password?
if it's your own server you should had them on your server instance creation.
else if you have a server from a hosting provider go in tools - create server query login and create one (if your can't create that means your hosting provider doesn't allow you to have one)
 
Top