Re: php telnet
| From: | Chris Lee | Date: | Wed, 19 Dec 2001 22:16:36 +0000 |
| Subject: | Re: php telnet | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78252@lists.php.net to get a copy of this message | ||
if I nc to my server on port 23 I get the same thing. ie there is nothing
wrong. your going to have to emulate the telnet protocal now, thats just the
connect string.
--
Chris Lee
lee@mediawaveonline.com
"Kancha" <kancha2np@yahoo.com> wrote in message
news:php.general-78200@news.php.net...
> 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]#
>