#26877 [Opn->Bgs]: fread() with URL reads only part of file

From: Date: Mon, 12 Jan 2004 10:28:57 +0000
Subject: #26877 [Opn->Bgs]: fread() with URL reads only part of file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-53164@lists.php.net to get a copy of this message
ID: 26877 Updated by: eru@php.net Reported By: dinklage at dinklage dot com -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: Linux PHP Version: 4.3.4 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php from http://www.php.net/fread <?php $handle = fopen("http://www.example.com/", "rb"); $contents = ""; do { $data = fread($handle, 8192); if (strlen($data) == 0) { break; } $contents .= $data; } while (true); fclose($handle); ?> Previous Comments: ------------------------------------------------------------------------ [2004-01-12 04:30:32] dinklage at dinklage dot com Description: ------------ Using fread() with URL returns only a part of the file: eg: reading http://schreiners-buero.de/sbinfo.htm with 25170 Byte is only 2550 Byte Reproduce code: --------------- $url='http://schreiners-buero.de/sbinfo.htm'; $fp = fopen($url,'rb'); $code = fread($fp,4000000); fclose($fp); echo "<p>length ".strlen($code)." </p>"; $code2=file_get_contents($url); echo "<p>length ".strlen($code2)." </p>"; exit; ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26877&edit=1

« previous php.bugs (#53164) next »