3

Im using the TS Framework to read out some data through the Teamspeak Query in PHP. But the documentation is horrible!

To display all IPs from all clients I use this code:

foreach($ts3_VirtualServer->clientList() as $client)
{
    // skip query clients
    if($client["client_type"]) continue;

    $clientInfo = $client->getInfo();
    echo $clientInfo['connection_client_ip'] . "<br>";
} 

(it's not the full code)

Where is the part in the documentation which says what getInfo() returns?

Documentation Link

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
Joba
  • 828
  • 9
  • 28
  • 1
    If the documentation doesn't help, use `var_dump($clientInfo)` to see what it contains. – Gerald Schneider Jan 06 '16 at 10:20
  • @Gerald Schneider Okay this is possible for my example. But the function getProperty(property) returns the value of the Property. But i cant find anywhere which Properties are possible for e.g. the virtualServer Variable!? https://docs.planetteamspeak.com/ts3/php/framework/class_team_speak3___node___abstract.html#a585728537b56194aeab30b0316126b89 http://stackoverflow.com/questions/22738039/teamspeak-query-number-of-connected-clients – Joba Jan 06 '16 at 12:19

1 Answers1

4

It's not in the documentation since it's abstract / generalized for all node objects.

As you can see from TeamSpeak3_Node_Abstract::getInfo():

if ($extend) {
  $this->fetchNodeInfo();
}

if ($convert) {
  $info = $this->nodeInfo;

  foreach ($info as $key => $val) {
    $key = TeamSpeak3_Helper_String::factory($key);
    //...
  }

  return $info;
}

return $this->nodeInfo;

The data returned (formatted or directly) is TeamSpeak3_Node_Abstract::$nodeInfo.

Searching GitHub repo for nodeInfo = shows how several of the (child) Nodes set their inherited nodeInfo property.

For example, we have TeamSpeak3_Node_Host::fetchNodeInfo() which uses properties returned by TeamSpeak3 Server Query commands hostinfo, instanceinfo:

protected function fetchNodeInfo() {
  $info1          = $this->request("hostinfo")->toList();
  $info2          = $this->request("instanceinfo")->toList();
  $this->nodeInfo = array_merge($this->nodeInfo, $info1, $info2);
}

Also, for example, TeamSpeak3_Node_Server::fetchNodeInfo() which uses properties returned by serverinfo command:

protected function fetchNodeInfo() {
  $this->nodeInfo = array_merge($this->nodeInfo,
    $this->request("serverinfo")->toList());
}

As you can imagine, several TeamSpeak3 objects have a corresponding *info command which returns that object's properties.

You can view several example results of these commands, along with properties returned, in the TeamSpeak3 Server Query manual. Here for example, the serverinfo command.

Also, at the end of the manual, you can find several list of object properties. For example, the virtual server properties.