View Full Version : How do you retrieve info
PurpleRaison
12-02-2006, 12:24
I am a student, and I trying to learn how to Teamspeak browser script from scratch. I do have some basic questions though.
How do I connect to the teamspeak server, and retrieve the information so I can import it into a database?
Thanks
You need to establish a connection to TeamSpeaks QueryPort (usually 51234).
This connection should be TCP and it works like telnet.
You can send commands that end with a new line. and the server will answer with one or more lines of data. each reply will end with a line that begins with OK or with ERROR
PurpleRaison
12-02-2006, 19:41
I am still rather confused.
Should I use something like
socket_create and socket_connect to establish the connection?
Then for the sake of simplicity I would like to retrieve the list of channels, and display them in the script for the moment.
Thanks
As you did not specify any programming language I assume you mean PHP.
If you are using PHP you should just use fsockopen (http://de.php.net/fsockopen). If you want to use the socket_ functions read the corresponding manual how to use them. If you want to learn how to use just read some sourcecode from one of the status scripts floating around here.
Maybe this is also something for you: http://cyts.midlink.org
PurpleRaison
13-02-2006, 21:18
Thank you DarkCyrus, I appreciate the help.
PurpleRaison
19-02-2006, 15:43
Hello again:
I have been able to connect to the server, and retrieve the status (running/not running), but I still am confused about how to get a simple listing of the channels.
Most scripts are very complex with respect to what I am trying to do. All my project is supposed to do is:
1. conntect to server
2. list channels
3. close connection
Here is what I have thus far:
<?php
// open connection, retrieve status, and close connection
function ServerConnect()
{
// set the information
global $errno, $errstr;
$host = "put server IP here";
$port = "51234";
$timeout = "36";
$socket = fsockopen($host, $port, $errno, $errstr, $timeout);
if(!$socket or fread($socket, 4) != "[TS]")
{
echo("Teamspeak is not running.");
}
else
{
echo("Teamspeak is running.");
}
echo $socket;
fputs($socket, "quit");
fclose($socket);
}
return ServerConnect();
?>
My question is really: what is the simplest method (ie. fewest lines of code) to retrieve and list the channels in a server.
Again, thank you for the help.
Untucked_Wil
25-02-2006, 05:21
I have looked all over the internet and in the forums here, but I couldn't find what I am looking for. This thread was the best one I could find. I am trying to retrieve the number of users currently in my TS server, but I am not getting very far. I have the same thing as PurpleRaison above, but that is about it. I couldn't get any of the ouput to show up so I added
$hi=fread($socket);
echo($hi); after the "Teamspeak is running" line thinking that will output the output from the socket, but that won't even work. The only thing I found anywhere as to how to send commands and get output is in the form
fputs($socket,"gi");
echo(fread($socket)); where gi is the command for global information, which contains the number of users, and fread to display the information.
I have tried looking through some scripts but they do many weird things I have not seen before. Any help is appreciated.
Thanks
PurpleRaison
25-02-2006, 14:12
one of the useful things to retrieve the list of available commands on the server ('help'), and display them.
One thing you can do is telnet into the server (example):
telnet 12.123.12.123 51234
**replace '12.123.12.123' with your TS server's real IP**
-- then type 'help' without quotes, and the list of all available commands will be displayed.
Untucked_Wil
25-02-2006, 15:40
Thanks for the quick reply,
I am able to do everything via telnet. I just need to know how to with php. So far I am able to open the connection and tell if the server is running. I then need to send the command "gi" to get the globabl information. And then read out the resulting output from that command. I can't seem to figure this out in php.
Then go to a PHP newsgroup or forum.
koolrayskorner.com
28-02-2006, 02:24
You might try takeing this code apart and seeing how it is done http://www.gryphonllc.com/
And you may post your server to my page if you wish for testing
www.koolrayskorner.com/tspeak
Only 50 servers allowed. all public servers welcome.
Make sure that the TCP Query post is open for getting all the chanel information posted..
KR
I am a student, and I trying to learn how to Teamspeak browser script from scratch. I do have some basic questions though.
How do I connect to the teamspeak server, and retrieve the information so I can import it into a database?
Thanks
If you want to send a command to the query interface you also need to send a \n ;)
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.