Witam, oto moj pierwszy skrypt w OO php5 i mam sporo problemow z jego zdebugowaniem:
<?php
$t = new telnet('host', '21');
$t->loop();
class telnet {
public $fp;
public __construct($host, $port) {
if (!preg_match('#^[0-255]{1,3}.[0-255]{1,3}.[0-255]{1,3}.[0-255]{1,3}$#', $host)) { $ip = gethostbyname($host);
if ($ip != $host) $host = $ip;
else trigger_error("telnet __construct - Bledny host - '$host'", E_USER_ERROR
); }
if ($port < 0 or
$port > 65536
) trigger_error("telnet __construct - Nieprawidlowy port - '$port'", E_USER_ERROR
); if ( (self::$fp = fsockopen($host, $port)) == false ) trigger_error("telnet __construct - Blad polaczenia!", E_USER_ERROR
); }
public __destruct() {
return true;
else return false;
}
public function loop() {
$out = '';
while(self::$fp) {
$dane = '';
if ($dane = self::input('o.txt') != false) {
while(!feof(self::$fp))$out.= fread(self::$fp, 1024
); }
self::ajax($out);
//sleep(1);
}
self::close();
return true;
}
private function ajax ($dane) {
echo '<script type="text/javascript"> $('response').innerHTML = '' . $dane . '';
</script>';
return true;
}
private function input ($plik) {
if ($fp = fopen($plik, 'r') == false) return false;
return $fget;
}
}
?>
Jako pierwszy jest blad: Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE on line 174
o co mu chodzi?