wez Thu Oct 27 16:31:19 2005 EDT
Modified files:
/phpdoc/en/reference/filesystem/functions fread.xml
Log:
clarify that greedy read is for regular local files only.
http://cvs.php.net/diff.php/phpdoc/en/reference/filesystem/functions/fread.xml?r1=1.17&r2=1.18&ty=u
Index: phpdoc/en/reference/filesystem/functions/fread.xml
diff -u phpdoc/en/reference/filesystem/functions/fread.xml:1.17
phpdoc/en/reference/filesystem/functions/fread.xml:1.18
--- phpdoc/en/reference/filesystem/functions/fread.xml:1.17 Fri Oct 14
04:56:55 2005
+++ phpdoc/en/reference/filesystem/functions/fread.xml Thu Oct 27 16:31:18 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.17 $ -->
+<!-- $Revision: 1.18 $ -->
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.25 -->
<refentry id="function.fread">
<refnamediv>
@@ -16,7 +16,7 @@
<simpara>
<function>fread</function> reads up to
<parameter>length</parameter> bytes from the file pointer
- referenced by <parameter>handle</parameter>. Reading stops when
+ referenced by <parameter>handle</parameter>. Reading stops when up to
<parameter>length</parameter> bytes have been read, EOF
(end of file) is reached, or (for network streams) when a
packet becomes available, whichever comes first.
@@ -63,11 +63,12 @@
<warning>
<para>
- When reading from network streams or pipes, such as those returned when
+ When reading from anything that is not a regular local file, such as
+ streams returned when
reading <link linkend="features.remote-files">remote files</link> or from
<function>popen</function> and <function>fsockopen</function>, reading
will stop after a packet is available. This means that you should
- collect the data together in chunks as shown in the example below.
+ collect the data together in chunks as shown in the examples below.
</para>
</warning>
<para>
@@ -75,6 +76,20 @@
<programlisting role="php">
<![CDATA[
<?php
+// For PHP 5 and up
+$handle = fopen("http://www.example.com/", "rb");
+$contents = stream_get_contents($handle);
+fclose($handle);
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = '';
while (!feof($handle)) {