Skip to content

Factory options and flags explained

TS3tools edited this page Oct 8, 2018 · 3 revisions

This wiki page will explain the factory $uri and it's options / flags.

The $uri describes how the ServerQuery connection will be made. If you don't add any options, you'll connect to the TeamSpeak server instance. If you add the server_id / server_uid / server_port or the server_name, you'll be connected on this specific virtual server.

Using the following example, you could manage virtualservers for example or just get information from the instance like the current installed version:

$TS3PHPFramework = new TeamSpeak3();
$uri = "serverquery://127.0.0.1:10011/";
$ts3_instance = $TS3PHPFramework->factory("$uri");

The next example is used to manage a specific virtualserver (in this case the one on port 9987) - manage channels, virtualserver properties, move / kick clients and so on:

$TS3PHPFramework = new TeamSpeak3();
$uri = "serverquery://127.0.0.1:10011/?server_port=9987";
$ts3_virtualserver = $TS3PHPFramework->factory("$uri");

Hint: You can use multiple options in your $uri, but always only a maximum of one flag.

Supported Options

All options needs to be added like a GET variable:

  • serverquery://127.0.0.1:10011/?server_port=9987
  • serverquery://127.0.0.1:10011/?server_port=9987&nickname=ScP
Option Explanation Hints
timeout This defines the timeout in seconds. The default is 10 seconds. If you have to high response time to your TeamSpeak, you may should increase this setting.
blocking This is used to register callbacks by events. The default is 1. See Example #14: Create a Simple Bot waiting for Events
ssh This is used to connect via SSH instead of telnet. The default is 0. Please note, that your server needs to support SSH.
nickname This sets the ServerQuery nickname Spaces must be written as %20.
no_query_clients This excludes ServerQuery clients from all responses like clientList(). -
use_offline_as_virtual When the server is stopped, you can add this flag to start it virtual in order to be able to access it. -
clients_before_channels Sets the option to decide whether clients should be sorted before sub-channels to support the new TeamSpeak 3 Client display mode or not. -
server_id / server_uid / server_port / server_name This defines to which server you would like to connect. -
channel_id / channel_name This defines, which channel you would like to edit after the connection is established. -
client_id / client_uid / client_name This defines, which client you would like to edit / poke or whatever after the connection is established. -

Support Flags (only one per $uri)

The flag needs to be added at the end of the $uri and like an anker:

  • serverquery://127.0.0.1:10011/?server_port=9987#use_offline_as_virtual
  • serverquery://127.0.0.1:10011/?server_port=9987&nickname=ScP#use_offline_as_virtual
Flag Explanation
no_query_clients This excludes ServerQuery clients from all responses like clientList().
use_offline_as_virtual When the server is stopped, you can add this flag to start it virtual in order to be able to access it.
clients_before_channels Sets the option to decide whether clients should be sorted before sub-channels to support the new TeamSpeak 3 Client display mode or not.

For further information, please refer to Data Structures > Data Structures > TeamSpeak3 > factory.