note 4510 modified in copy by ronabop
| From: | ronabop@php.net | Date: | Mon, 02 Oct 2000 10:28:20 +0000 |
| Subject: | note 4510 modified in copy by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5874@lists.php.net to get a copy of this message | ||
I am just fopen()'ing the file and doing read/write to the local file. Like so:
if (!($fp = fopen($srcfile,"r"))) die("Could not open src");
if (!($fp2 = fopen($file,"w"))) die("Could not open dest");
while ($contents = fread( $fp, 4096 )) {
fwrite( $fp2, $contents, strlen($contents) );
}
fclose($fp);
fclose($fp2);
Just to be a little more clear on the above... the $srcfile is a URL (in my case, it's "http://www.slashdot.org/slashdot.xml" but
it could be an FTP or any other proper URL)
http://www.php.net/manual/function.copy.php