
Originally Posted by
savos
// connect to local server, authenticate and spawn an object for the virtual server on port 9987
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://<username>:<password>@<address>:10011/?server_port=9987");
Maybe you're just hiding credentials for the post, but you did make sure to put in real values for <username>, <password>, <address>?
Otherwise, your code looks fine...

Originally Posted by
mr-brown
Hello ma friends,
i have a problem where i need help.
The API is working fine when i am running it local under xampp with a puplic (not local) teamspeak.
Then i uploaded it to my webspace and i only get the following message:
The teamspeak server is working, i also can connect the server query with putty.
I think my webspace provider (
https://www.hetzner.de/) is blocking outgoing connections like it is used in the API.
How can i verify this?
It is possible to check the requirements with phpinfo()?
I would appreciate help.
Your web host should provide you with ssh access. You can login, and then test with using telnet:
$ telnet <remote teamspeak IP> 10011
You should see the TeamSpeak 3 Server Query prompt.

Originally Posted by
Webster23
Hello,
I am trying to make a function that moves people when they login. However, the functions of
Code:
$ts3_VirtualServer->notifyRegister("server");
$ts3_VirtualServer->notifyRegister("channel");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyLogin", "onLogin");
function onLogin(TeamSpeak3_Node_Host $host){
....
}
are not working. I believe the notifyLogin is what is called when someone joins the server, however it is not firing. Any help would be nice.
notifyLogin is not emitted when someone joins the server.
It is emitted from TeamSpeak3_Node_Host::login().
"Authenticates with the TeamSpeak 3 Server instance using given ServerQuery login credentials."
[doc] [src]
The notify event you're looking for is notifyCliententerview.
You can subscribe and register as follows:
PHP Code:
// Subscribe to event.
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyCliententerview", "onClientEnterView");
// Connect to server, login and get TeamSpeak3_Node_Host object by URI
$ts3 = TeamSpeak3::factory("serverquery://" . $cfg["user"] . ":" . $cfg["pass"] . "@" . $cfg["host"] . ":" . $cfg["query"] . "/?server_port=" . $cfg["voice"] . "&blocking=0");
// Register for events as needed...
$ts3->notifyRegister("server");
$ts3->notifyRegister("channel");
$ts3->notifyRegister("textserver");
$ts3->notifyRegister("textchannel");
$ts3->notifyRegister("textprivate");
function onClientEnterView(TeamSpeak3_Node_Host $host){
// move client to target channel...
}

Originally Posted by
DerRene
How can i give a channel group to a user?
Please search the documentation before posting:
TeamSpeak3_Node_Server::clientSetChannelGroup($cld bid, $cid, $cgid)

Originally Posted by
ibot3
Hello,
I'm trying to get a TS viewer. It's working fine on the one mashine but not working on the other. I'm getting this error:
https://pastebin.com/dnDeaCW0
(Can't paste it here, because the page forbids me to submit the post with the error)
My Code:
Code:
public function GetViewer(){
return $this->worker->getViewer(new TeamSpeak3_Viewer_Html("assets/img/teamspeak_viewer/", "assets/img/countryflags-dis/", "data:image"));
}
Retrieving server information like online users is working fine with the same instance of the API.
I recommend double-checking the file locations on the other machine:
'assets/img/teamspeak_viewer/'
'assets/img/countryflags-dis/'
You might also try absolute path ('/....../assets/img/.....', etc) just to be safe.

Originally Posted by
Myszax
I think I found some kind of bugs.
1. When channel is named as number eg.
123456 then
channelList() return this
channel_name as
integer not as
TeamSpeak3_Helper_String.
Edit:
I found fix for second bug on github:
https://github.com/planetteamspeak/t...07492fb7e32225
Also I found another issue in situation that normally can not happen.
3. When I tried to download avatar and avatar file does not exist in
ts_server_dir/files/virtualserver_1/internal my script get stuck, some kind of freeze and the only way to handle this is to kill process.
This could happen when some own copy server without
files folder like I did for fast backup for tests only.
Myszax.
2nd bug is on GitHub repo as you found.
I can confirm 1st bug. If you have not already, I highly recommend opening two issues (one of each bug, 1st and 3rd).
This will greatly speed testing / fix implementation.
Thank you for pointing this out and providing examples, really helps a lot!

Originally Posted by
specialMen_
Guys I make a control panel, To control my server, Stop the server, start the server, Server Information.
When I stop the server The Website Is stop.
So how I can fix that problem?,
What do you mean by 'the website is stop'?
From your code, I see no loop logic that would stop the webpage from stopping after the framework request is finished.
If you want live server info, you need to use a loop (not recommended) or asynchronous refresh your server properties.
However, I'm still not sure exactly what issue you're having.

Originally Posted by
mr-brown
Please close the threat. Doesn't make sense to post here.
There is no support at all.
There are many ways to find the information for yourself:
With almost 100 pages of questions / examples in this forum, you can search google: 'how do I... site:forum.teamspeak.com'
You can check docs: https://docs.planetteamspeak.com/ts3/php/framework/
You can search source code: https://github.com/planetteamspeak/ts3phpframework
If you need real support, in the form of a bug fix, you can create an issue at the GitHub repo.
(not meaning to aggravate, just pointing out many sources of information, in case you are not aware...)

Originally Posted by
orydek
My bot only working 10min. Someone have any solutions?
You need to handle keepalive, otherwise your bot will be timed out by the TeamSpeak 3 server after 10 minutes.
Please search before simply posting, there are many examples of this. Some keywords to search with might be 'timeout', 'keepalive', etc.
NOTE: There may be bug in published / release version of the framework. Recommend downloading the latest directly from GitHub.
onServerQueryTimeout Bug: https://github.com/planetteamspeak/t...c9e88dca9dae19
Download latest version: https://github.com/planetteamspeak/t...ive/master.zip
Here is an example ScP gave for 'event based daemon', which implements onTimeout() keepalive logic:
PHP Code:
<?php
/* load framework library */
require_once("TeamSpeak3/TeamSpeak3.php");
/* initialize */
TeamSpeak3::init();
try
{
/* subscribe to various events */
TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryConnected", "onConnect");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryWaitTimeout", "onTimeout");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyLogin", "onLogin");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyEvent", "onEvent");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServerselected", "onSelect");
/* connect to server, login and get TeamSpeak3_Node_Host object by URI */
$ts3 = TeamSpeak3::factory("serverquery://username:[email protected]:10011/?server_port=9987&blocking=0");
/* wait for events */
while(1) $ts3->getAdapter()->wait();
}
catch(Exception $e)
{
die("[ERROR] " . $e->getMessage() . "\n");
}
// ================= [ BEGIN OF CALLBACK FUNCTION DEFINITIONS ] =================
/**
* Callback method for 'serverqueryConnected' signals.
*
* @param TeamSpeak3_Adapter_ServerQuery $adapter
* @return void
*/
function onConnect(TeamSpeak3_Adapter_ServerQuery $adapter)
{
echo "[SIG]\tconnected to TeamSpeak 3 Server on " . $adapter->getHost() . "\n";
echo "[INFO]\tserver is running with version " . $adapter->getHost()->version("version") . " on " . $adapter->getHost()->version("platform") . "\n";
}
/**
* Callback method for 'serverqueryWaitTimeout' signals.
*
* @param integer $seconds
* @return void
*/
function onTimeout($seconds, TeamSpeak3_Adapter_ServerQuery $adapter)
{
echo "[SIG]\tno reply from the server for " . $seconds . " seconds\n";
if($adapter->getQueryLastTimestamp() < time()-300)
{
echo "[INFO]\tsending keep-alive command\n";
$adapter->request("clientupdate");
}
}
/**
* Callback method for 'notifyLogin' signals.
*
* @param TeamSpeak3_Node_Host $host
* @return void
*/
function onLogin(TeamSpeak3_Node_Host $host)
{
echo "[SIG]\tauthenticated as user " . $host->whoamiGet("client_login_name") . "\n";
}
/**
* Callback method for 'notifyEvent' signals.
*
* @param TeamSpeak3_Adapter_ServerQuery_Event $event
* @param TeamSpeak3_Node_Host $host
* @return void
*/
function onEvent(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host)
{
echo "[SIG]\treceived notification " . $event->getType() . "\n\t" . $event->getMessage() . "\n";
}
/**
* Callback method for 'notifyServerselected' signals.
*
* @param string $cmd
* @return void
*/
function onSelect(TeamSpeak3_Node_Host $host)
{
echo "[SIG]\tselected virtual server with ID " . $host->serverSelectedId() . "\n";
$host->serverGetSelected()->notifyRegister("server");
$host->serverGetSelected()->notifyRegister("channel");
$host->serverGetSelected()->notifyRegister("textserver");
$host->serverGetSelected()->notifyRegister("textchannel");
$host->serverGetSelected()->notifyRegister("textprivate");
}
[ref]

Originally Posted by
DerRene
I got the following script to list all connected Clients, but i want to show the Server Group Icons of the Users as well in the list. How can i add that? I dont understand...
Code:
echo "<div class='list-group'>";
foreach($ts3_VirtualServer->clientList() as $client) {
echo "<a href='#' class='list-group-item'>" . $client . "</a>";
}
echo "</div>";
This is just some pseudo-code to get you going in the right direction:
PHP Code:
echo "<div class='list-group'>";
foreach($ts3_VirtualServer->clientList() as $client) {
// Open row / line / link tag
echo "<a href='#' class='list-group-item'>" . $client;
foreach($client->memberOf() as $group) {
// Get raw byte data for image, encoded in whatever the icon's Mime type is.
$iconData = $group->iconDownload();
// Dump raw image data by base64 encoding into HTML <img /> tag.
echo ' <img src="data:' . TeamSpeak3_Helper_Convert::imageMimeType($iconData) . ';base64,' . base64_encode($iconData) . '" alt="'.$group['name'].'" /> ';
}
echo "</a>";
}
echo "</div>";
Again, this is untested pseudo-code, please troubleshoot / adjust as needed, but hopefully will give you an idea of how to do it.
You will probably need additional styling to render icons inline, etc.