stream_copy_to_stream
stream_copy_to_stream
Copies data from one stream to another
**stream_copy_to_stream** resource $from resource $to $length int $offset
Makes a copy of up to bytes
of data from the current position (or from the
position, if specified) in
to . If
is null, all remaining content in
will be copied.
length``offset``from``to``length``from
fromThe source stream
toThe destination stream
lengthMaximum bytes to copy. By default all bytes left are copied.
offsetThe offset where to start to copy data
Returns the total count of bytes copied,return.falseforfailure.
Voorbeeld: A example
<?php
$src = fopen('http://www.example.com', 'r');
$dest1 = fopen('first1k.txt', 'w');
$dest2 = fopen('remainder.txt', 'w');
echo stream_copy_to_stream($src, $dest1, 1024) . " bytes copied to first1k.txt\n";
echo stream_copy_to_stream($src, $dest2) . " bytes copied to remainder.txt\n";
?>
copy