Page 1 of 1

feof , http and hanging...

Posted: Tue Aug 04, 2009 2:27 am
by bucz
hello,

I tried to connect to a http server (google. for example) using sockets. i have opened socked, got a full reply from the server and... my code is dead-looping. It does not recognize EOF i think. I have read that there are some issues with EOF, I have tried different thinks and nothing... any ideas?

for example this is dead-looping:

Code: Select all

 
        $cur = fgets($fp,1024);
        while(!feof($fp)){
            echo $cur;
            $cur = fgets($fp,1024);
        }
 

Re: feof , http and hanging...

Posted: Tue Aug 04, 2009 3:19 am
by dejvos
Why you don't use some PEAR library .... http://pear.php.net/search.php?q=HTTP_R ... es&x=0&y=0

I'm not sure if it works throught your way.

Re: feof , http and hanging...

Posted: Tue Aug 04, 2009 7:17 am
by jackpf
Or you could just use cURL :)

Re: feof , http and hanging...

Posted: Tue Aug 04, 2009 9:42 am
by bucz
can i use all that tools when i am NOT working on my own server? could they be installed locally somehow?

Re: feof , http and hanging...

Posted: Tue Aug 04, 2009 10:21 am
by jackpf
Yes. Do you have apache & php installed?

Re: feof , http and hanging...

Posted: Tue Aug 04, 2009 1:41 pm
by bucz
yup, apache and php are on the board

Re: feof , http and hanging...

Posted: Tue Aug 04, 2009 1:46 pm
by jackpf
Then you need to download the relevant dll or so (depending on your OS), and put a line (or uncomment it if it already exists) in php.ini with something like:

[PHP_EXTENSION]
extension=extension.dll

But replacing extension with the extension.

Re: feof , http and hanging...

Posted: Tue Aug 04, 2009 2:52 pm
by bucz
and DLL is a 'real windows dll' or it shall also go with linux?

Re: feof , http and hanging...

Posted: Thu Aug 06, 2009 7:43 am
by jackpf
You'll need a .so file for linux.