How to get Teamspeak Status/Uptime/Servername/Version/Clients/Slots

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
You need the TeamSpeak 3 PHP Framework! I don't write a tutorial how to use this, because you should know PHP to use this and i don't like to see that somebody just uses copy pasta :)
PHP:
//Show the ip of your server
$ts3->getAdapterHost()
PHP:
//Show the port of your server
$ts3->virtualserver_port
PHP:
//Show the name of your server
$ts3->virtualserver_name
PHP:
//Show the current uptime of your server
TeamSpeak3_Helper_Convert::seconds($ts3->virtualserver_uptime)
PHP:
//Show the current server version
TeamSpeak3_Helper_Convert::version($ts3->virtualserver_version)
PHP:
//Show the current online clients
$ts3->virtualserver_clientsonline
PHP:
//Show the max clients
$ts3->virtualserver_maxclients
 

Exp

Member
Oct 7, 2015
10
5
38
PHP:
$name = $ts3_VirtualServer->clientGetById($clientid);
//Getting system
$system = $name["client_platform"];

//Getting connections time
$connections = $name->client_totalconnections; 

//Getting description
$desc = $name->client_description;
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
but how to work ?
Code:
  $rIP = $_POST["IP"];
  $vPORT = $_POST["PORT"];
  $vQPORT = $_POST["QPORT"];

  require_once("libraries/TeamSpeak3/TeamSpeak3.php");

  try{
  $ts3 = TeamSpeak3::factory("serverquery://@$rIP:$vQPORT/?server_port=$vPORT");
  echo "Clients online: $ts3->virtualserver_clientsonline / $ts3->virtualserver_maxclients";
  }
  catch(Exception $e)
  {
  echo "Unable to connect to the Server";
  }
 

r00t-Server

Member
Nov 3, 2015
56
14
43
Would you explain short work please know in order to understand this allowance but where we put code
:confused::(
 

r00t-Server

Member
Nov 3, 2015
56
14
43
He has knowledge in the language of php but not related to where my friend

But you must be working on a simplified explanation to be the simplest to the person Shi Thank you

:)
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
The following is a project i made when i was mad but it's very old and it wont work very well so you shouldn't c&p it but if you understand php, you should understand how this works :)

HTML:
<div class="form-group">
  <form method="POST">
  <div id="nebeneinander">
  <p style="margin-top:3px;font-size:10pt;float: left; cursor:default;" class="btn btn-sm">IP / Domain:</p><input maxlength="30" placeholder="Ex: 127.0.0.1" style="text-align:center;float:left; width:120px;" class="form-control" id="inputDefault" TYPE = "Text" VALUE ="" NAME = "IP">
  <p style="margin-top:3px;font-size:10pt;float: left; cursor:default;" class="btn btn-sm">Port:</p><input maxlength="5" placeholder="9987" style="text-align:center;float:left; width:60px;" class="form-control" id="inputDefault" TYPE = "Text" VALUE ="" NAME = "PORT">
  <p style="margin-top:3px;font-size:10pt;float: left; cursor:default;" class="btn btn-sm">Query Port:</p><input placeholder="10011" maxlength="5" style="text-align:center;float:left; width:60px;" class="form-control" id="inputDefault" TYPE = "Text" VALUE ="" NAME = "QPORT">
   
  <input style="float:left; margin-left:10px;" type="submit" class="btn btn-default" name="button" value="Check this Server"/>
  </div></form>
  <br /><br />
PHP:
if(isset($_POST['button']))
  {
  $rIP = $_POST["IP"];
  $vPORT = $_POST["PORT"];
  $vQPORT = $_POST["QPORT"];
  require_once("libraries/TeamSpeak3/TeamSpeak3.php");
  try
  {
  $ts3 = TeamSpeak3::factory("serverquery://@$rIP:$vQPORT/?server_port=$vPORT");
  echo "
  <table class=\"table table-striped table-hover \">
  <thead>
  <tr>
  <th>Server Status</th>
  <th>Server Name</th>
  <th>Server Adresse</th>
  <th>Slots</th>
  <th>Server Version</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style=\"color:#00C900;\">Online</td>
  <td>$ts3->virtualserver_name</td>
  <td>$rIP:$ts3->virtualserver_port</td>
  <td>$ts3->virtualserver_clientsonline / $ts3->virtualserver_maxclients</td>
  <td>$ts3->virtualserver_version</td>
  ";
  }
  catch(Exception $e)
  {
  echo "
  <table class=\"table table-striped table-hover \">
  <thead>
  <tr>
  <th>Server Status</th>
  <th>Server Name</th>
  <th>Server Adresse</th>
  <th>Slots</th>
  <th>Server Version</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style=\"color:#FF0000;\">Offline</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  ";
  }
  }
f60defa639.png

e9e82aa8d8.png

a980f1ad5d.png
 

r00t-Server

Member
Nov 3, 2015
56
14
43
Do you raise the script is ready and raised here Shi be the best we see and learn from you and you and take advantage of this beautiful thing

Thank you for this beautiful explanation :(
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
I don't understand your problem... I gave you a whole source of this stuff and you still want an explanation? If you would have knowlege php you should understand how this works.
Take a closer look at those things or join the r4p3 teamspeak and ask me every question you have.
Code:
require_once("libraries/TeamSpeak3/TeamSpeak3.php");

  $ts3 = TeamSpeak3::factory("serverquery://@$rIP:$vQPORT/?server_port=$vPORT");

<td>$ts3->virtualserver_name</td>
<td>$rIP:$ts3->virtualserver_port</td>
<td>$ts3->virtualserver_clientsonline / $ts3->virtualserver_maxclients</td>
<td>$ts3->virtualserver_version</td>
 
Dec 19, 2015
114
15
53
The following is a project i made when i was mad but it's very old and it wont work very well so you shouldn't c&p it but if you understand php, you should understand how this works :)

HTML:
<div class="form-group">
  <form method="POST">
  <div id="nebeneinander">
  <p style="margin-top:3px;font-size:10pt;float: left; cursor:default;" class="btn btn-sm">IP / Domain:</p><input maxlength="30" placeholder="Ex: 127.0.0.1" style="text-align:center;float:left; width:120px;" class="form-control" id="inputDefault" TYPE = "Text" VALUE ="" NAME = "IP">
  <p style="margin-top:3px;font-size:10pt;float: left; cursor:default;" class="btn btn-sm">Port:</p><input maxlength="5" placeholder="9987" style="text-align:center;float:left; width:60px;" class="form-control" id="inputDefault" TYPE = "Text" VALUE ="" NAME = "PORT">
  <p style="margin-top:3px;font-size:10pt;float: left; cursor:default;" class="btn btn-sm">Query Port:</p><input placeholder="10011" maxlength="5" style="text-align:center;float:left; width:60px;" class="form-control" id="inputDefault" TYPE = "Text" VALUE ="" NAME = "QPORT">
  
  <input style="float:left; margin-left:10px;" type="submit" class="btn btn-default" name="button" value="Check this Server"/>
  </div></form>
  <br /><br />
PHP:
if(isset($_POST['button']))
  {
  $rIP = $_POST["IP"];
  $vPORT = $_POST["PORT"];
  $vQPORT = $_POST["QPORT"];
  require_once("libraries/TeamSpeak3/TeamSpeak3.php");
  try
  {
  $ts3 = TeamSpeak3::factory("serverquery://@$rIP:$vQPORT/?server_port=$vPORT");
  echo "
  <table class=\"table table-striped table-hover \">
  <thead>
  <tr>
  <th>Server Status</th>
  <th>Server Name</th>
  <th>Server Adresse</th>
  <th>Slots</th>
  <th>Server Version</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style=\"color:#00C900;\">Online</td>
  <td>$ts3->virtualserver_name</td>
  <td>$rIP:$ts3->virtualserver_port</td>
  <td>$ts3->virtualserver_clientsonline / $ts3->virtualserver_maxclients</td>
  <td>$ts3->virtualserver_version</td>
  ";
  }
  catch(Exception $e)
  {
  echo "
  <table class=\"table table-striped table-hover \">
  <thead>
  <tr>
  <th>Server Status</th>
  <th>Server Name</th>
  <th>Server Adresse</th>
  <th>Slots</th>
  <th>Server Version</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style=\"color:#FF0000;\">Offline</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  ";
  }
  }
f60defa639.png

e9e82aa8d8.png

a980f1ad5d.png

please can i get the style of the picture
 

GlumiChan

Member
Mar 2, 2016
8
0
36
The Framework does not contain 'client_description' anymore :/
Not in the Clientlist and not in the ClientFindByXXX
Where is the ClientDescription gone? O:

EDIT (Solved):
Solution: The "client_descrpition" is only available when the Client actually has a Description.. So you have to check it before you want to loop through clientlist and their descriptions.
 
Last edited:
Top