Update re: parameters now accepting string urls

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@123914 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sara Golemon 2003-04-19 03:01:32 +00:00
parent d99a740435
commit b8b328e7da

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.stream-copy-to-stream">
<refnamediv>
<refname>stream_copy_to_stream</refname>
@ -9,10 +9,20 @@
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>stream_copy_to_stream</methodname>
<methodparam><type>resource</type><parameter>source</parameter></methodparam>
<methodparam><type>resource</type><parameter>dest</parameter></methodparam>
<methodparam><type>resource|string</type><parameter>source</parameter></methodparam>
<methodparam><type>resource|string</type><parameter>dest</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>maxlength</parameter></methodparam>
</methodsynopsis>
<simpara>
<parameter>source</parameter> and <parameter>dest</parameter> can each be
either an active stream resource (opened with <function>fopen</function>,
<function>fsockopen</function>, <function>stream_socket_connect</function>,
<function>stream_socket_accept</function>, or another stream creation
function), or a string pointing to a filename or valid wrapper resource.
If <parameter>source</parameter> or <parameter>dest</parameter> are strings,
<literal>PHP</literal> will attempt to open the stream from reading or
writting as appropriate, perform the copy, then close it.
</simpara>
<para>
Makes a copy of up to <parameter>maxlength</parameter> bytes
of data from the current position in <parameter>source</parameter> to
@ -31,6 +41,19 @@ $dest2 = fopen('remainder.txt','w');
print stream_copy_to_stream($src, $dest1, 1024) . " bytes copied to first1k.txt\n";
print stream_copy_to_stream($src, $dest2) . " bytes copied to remainder.txt\n";
?>
]]>
</programlisting>
</example>
<example>
<title>Using <function>stream_copy_to_stream</function> on urls</title>
<programlisting role="php">
<![CDATA[
<?php
$src = 'http://www.example.com/path/to/file.txt';
$dest = 'compress.zlib://file.txt';
print stream_copy_to_stream($src, $dest) . " bytes copied from webserver and written to compressed local file.\n";
?>
]]>
</programlisting>