well because i'm not connecting to a web server ...


----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: "Arnauld Dravet - smurfie" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, July 27, 2001 3:35 AM
Subject: Re: [PHP] problem while reading on sockets ...


> On Thu, 26 Jul 2001 23:43, Arnauld Dravet - smurfie wrote:
> > Hello,
> >
> > simple question:
> >
> > $sock = fsockopen($server_ip, $server_port, $errno, $errstr, 30);
> > while(!feof($sock)) echo fgets($sock,4096);
> > fclose($sock);
> >
> > why does the while() makes an infinite loop, like if FEOF was never
> > found ? what is the character used to tell if there's an EOF or not ?
> > could my problem come from the server i'm connecting to which to not
> > send a "legit" string ?
> >
> > thanks
> >
> > Arnauld Dravet
> > [EMAIL PROTECTED]
>
> Not having done this, but wouldn't you need to send a GET to the server
> to have it return something? At least that seems to be what the example
> in the manual does.
>
> $fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
> if (!$fp) {
> echo "$errstr ($errno)<br>\n";
> } else {
> fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
> while (!feof($fp)) {
> echo fgets ($fp,128);
> }
> fclose ($fp);
> }
>
>
> --
> David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
> CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA
>
>    Cause of crash: Inadvertent contact with the ground.
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to