I would suggest that you take a look at the source code for the Teamspeak Block for php-nuke and see how they did it (which is how I often figure out how to do stuff)
I just checked the source code and they used fsockopen() too.
Here is how they got the player list, after all the connections have been made (note, $this refers to a class that is handling all the telnet work):
PHP Code:
$this->sendQuery($this->socket,"pl");
// read player info
$this->playerList = array();
do {
$playerinfo = fscanf($this->socket, "%s %d %d %d %d %d %d %d %d %d %d %d %d %s %s");
list($playerid, $channelid, $receivedpackets, $receivedbytes, $sentpackets, $sentbytes, $d, $d, $totaltime, $idletime, $d, $d, $d, $s, $playername) = $playerinfo;
if($playerid != "OK") {
$this->playerList[$playerid] = array("playerid" => $playerid,
"channelid" => $channelid,
"receivedpackets" => $receivedpackets,
"receivedbytes" => $receivedbytes,
"sentpackets" => $sentpackets,
"sentbytes" => $sentbytes,
"totaltime" => $totaltime,
"idletime" => $idletime,
"playername" => $this->stripQuotes($playername));
}// end if
} while($playerid != "OK");
And fyi, I don't see any sign of the author setting up a header for the connection, The whole telnet process seems pretty straight forward.
IcI