php telnet
| From: | kancha | Date: | Wed, 19 Dec 2001 12:14:57 +0000 |
| Subject: | php telnet | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78200@lists.php.net to get a copy of this message | ||
The following code generated garbase output. what is wrong ??
<?php
$sp = fsockopen("localhost", 23);
if(!$sp){
echo "error";
exit;
}
socket_set_blocking($sp, FALSE);
function getLine(){
global $sp;
$op = fgets($sp, 1024);
while(empty($op)){
$op = fgets($sp, 1024);
}
return $op;
}
echo getLine();
?>
The output was as follows:
[root@ispms html]# php telnet.php
X-Powered-By: PHP/4.1.0
Content-type: text/html
ÿý▒ÿý ÿý#ÿý'[root@ispms html]#