Simple PHP TeamSpeak 3 Status

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";
}
?>
 

fyfywka

TeamSpeak Developer
Contributor
Sep 10, 2015
147
140
158
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php"); // path to teamspeak framework

$login =       "serveradmin";   // Login
$password =    "pass";  // Password
$host =        "ip";   // Server IP adress
$voiceport =   9987;        // voice port (default 9987)
$queryport =   10011;       // query port (default 10011)


try {
    $ts3_connect = TeamSpeak3::factory("serverquery://".$login.":".$password."@".$host.":".$queryport."/?server_port=".$voiceport);

    echo "<table><tr>
    <td>Server Status:</td><td class='server_online'>".$ts3_connect->virtualserver_status."</td>
    </tr><tr>
    <td>Server Name</td><td class='server_name'>".$ts3_connect->virtualserver_name."</td>
    </tr><tr>
    <td>Server Adress:</td><td class='server_adress'>".$ts3_connect->getAdapterHost()."</td>
    </tr><tr>
    <td>Server Uptime:</td><td class='server_uptame'>".TeamSpeak3_Helper_Convert::seconds($ts3_connect->virtualserver_uptime)."</td>
    </tr><tr>
    <td>Users:</td><td class='server_users'>".($ts3_connect->virtualserver_clientsonline-$ts3_connect->virtualserver_queryclientsonline)."/".$ts3_connect->virtualserver_maxclients."</td>
    </tr><tr>
    <td>Channels:</td><td class='server_channels'>".$ts3_connect->virtualserver_channelsonline."</td>
    </tr><tr>
    <td>Download:</td><td class='server_download'>".TeamSpeak3_Helper_Convert::bytes($ts3_connect->connection_filetransfer_bytes_received_total + $ts3_connect->connection_bytes_received_total)."</td>
    </tr><tr>
    <td>Upload:</td><td class='server_upload'>".TeamSpeak3_Helper_Convert::bytes($ts3_connect->connection_filetransfer_bytes_sent_total + $ts3_connect->connection_bytes_sent_total)."</td>
    </tr></table>";
} catch(Exception $e) {
    echo "<p class='server_error'> ERROR: </p>".$e->getMessage();
}
 
Last edited:

Rayger_X

Member
Sep 12, 2015
36
20
43
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php"); // path to teamspeak framework

$login =       "serveradmin";   // Login
$password =    "pass";  // Password
$host =        "ip";   // Server IP adress
$voiceport =   9987;        // voice port (default 9987)
$queryport =   10011;       // query port (default 10011)


try {
    $ts3_connect = TeamSpeak3::factory("serverquery://".$login.":".$password."@".$host.":".$queryport."/?server_port=".$voiceport);

    echo "<table><tr>
    <td>Server Status:</td><td class='server_online'>".$ts3_connect->virtualserver_status."</td>
    </tr><tr>
    <td>Server Name</td><td class='server_name'>".$ts3_connect->virtualserver_name."</td>
    </tr><tr>
    <td>Server Adress:</td><td class='server_adress'>".$ts3_connect->getAdapterHost()."</td>
    </tr><tr>
    <td>Server Uptime:</td><td class='server_uptame'>".TeamSpeak3_Helper_Convert::seconds($ts3_connect->virtualserver_uptime)."</td>
    </tr><tr>
    <td>Users:</td><td class='server_users'>".($ts3_connect->virtualserver_clientsonline-$ts3_connect->virtualserver_queryclientsonline)."/".$ts3_connect->virtualserver_maxclients."</td>
    </tr><tr>
    <td>Channels:</td><td class='server_channels'>".$ts3_connect->virtualserver_channelsonline."</td>
    </tr><tr>
    <td>Download:</td><td class='server_download'>".TeamSpeak3_Helper_Convert::bytes($ts3_connect->connection_filetransfer_bytes_received_total + $ts3_connect->connection_bytes_received_total)."</td>
    </tr><tr>
    <td>Upload:</td><td class='server_upload'>".TeamSpeak3_Helper_Convert::bytes($ts3_connect->connection_filetransfer_bytes_sent_total + $ts3_connect->connection_bytes_sent_total)."</td>
    </tr></table>";
} catch(Exception $e) {
    echo "<p class='server_error'> ERROR: </p>".$e->getMessage();
}
changed only ts3_
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
changed only ts3_
He also changed all those echo`s into one echo :)

btw this could look like the page on my website if you use css :p
6c91b54043.png
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
better question for me is why the hell im i always the one thats spamming the forum activity xD i should stop :p
3bc2a76d8e.png


You could wait until anybody posted something before you post anything new :D But it's good to see much activity from you :)
 

X-Ecutioner

Contributor
Sep 16, 2015
183
121
175
It's a test, the firewall of web site r4p3.net is to hard, so i can't reply to all post :/
I'm connect with the computer of my friend in his house :/
And I have push like :)
 

Supervisor

Administrator
Apr 27, 2015
1,863
2,546
335
It's a test, the firewall of web site r4p3.net is to hard, so i can't reply to all post :/
I'm connect with the computer of my friend in his house :/
And I have push like :)
Alright, so I hope my post is gonna be the last one being offtopic.
@calebfr We do have a tight protection, so most likely: something you wanted to post may be used to do bad things
 

ptR

Member
Nov 15, 2015
47
0
38
I have teamspeak 3 servers [1server]->[Xvirtual_server] how can i count all slots? used and free slots? Thanks! *Solved! :D
 
Last edited:
Top