PDA

View Full Version : Query/PHP Function


Skaschy
17-10-2004, 22:56
Hey,

i've got a problem with my class


<?php
class ts2info
{
var $ip = "217.20.114.230"; //Server IP
var $port = 51234; //Query Port
var $sport = 8767; //Server Port
var $source;

function ts2info()
{
if ($this->source = @fsockopen($this->ip,$this->port, &$errno, &$errstr, 1)) {
return true;
} else {
return false;
}
}
function ts2FetchData($query)
{
fputs($this->source,$query, strlen($query));
do {
$data .= fgetc($this->source);
$status = socket_get_status($this->source);
} while ($status["unread_bytes"]);
return $data;
$this->ts2Disconnect();
}
function ts2Disconnect()
{
fputs($this->source,"quit", strlen("quit"));
fclose($this->source);
}
}

$ts2 = new ts2info;

print $ts2->ts2FetchData("ver");
?>


This only give

[TS]

whats wrong?

Toby

Catch22
30-10-2004, 14:40
I think you must write fgets(), not fgetc()