ID:               21202
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         Sockets related
 Operating System: Linux, 2.4.19
 PHP Version:      4.2.3
 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.




Previous Comments:
------------------------------------------------------------------------

[2002-12-26 16:06:36] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

------------------------------------------------------------------------

[2002-12-26 16:05:01] [EMAIL PROTECTED]

Hi there... I wanted to fetch a webpage's contents. I used to be able
to do so by fread'ing with a huge number as length:

//////////////////
$fp=fsockopen( $host, $port, $errno, $errstr, 120 ); 
// assumed host and port were previously defined
$headers = 
                "GET /jornalmn/index.htm HTTP/1.0\r\n"
                ."User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1)\r\n"
                ."Host: www.meionorte.com\r\n"
                ."Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*\r\n"
                ."Connection: Keep-Alive\r\n"
                ."Cache-Control: no-cache\r\n"
                ."\r\n";

fwrite($fp,$headers, strlen($headers));
$fetched_content = fread($fp,1000000000);
fclose($fp);
////////////////

Just recently this stopped working. Actually, I would eventually fetch
the page, but only after the connection timed out. After a lot of
debugging I found out I'd have sucess by specifying the EXACT file size
to fread. I had to adapt my scripts and tell them to either:

a) Capture the "Content-length" response value sent by the server (easy
way);
b) Fread little by little (128 bytes a time) and use
socket_get_status($fp) everytime to check for EOF condition and the
number of unread bytes.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21202&edit=1

Reply via email to