note 4510 deleted from function.copy by jimw
| From: | jimw@php.net | Date: | Fri, 07 Dec 2001 02:09:17 +0000 |
| Subject: | note 4510 deleted from function.copy by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-21800@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)