note 25872 deleted from function.file-get-contents by sniper
| From: | sniper@php.net | Date: | Fri, 21 Feb 2003 04:42:11 +0000 |
| Subject: | note 25872 deleted from function.file-get-contents by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-44287@lists.php.net to get a copy of this message | ||
Here is my Code how to Copy a file from a website to
local harddisk without the file_get_contents function.
it is binary-safe, but its not the fastest way:
function filecopy($urlsrc,$localdst) {
$fp_urlsrc = fopen($urlsrc,"r");
$del_File = fopen($localdst,"w");
fwrite($del_File,"");
fclose ($del_File);
while (!feof($fp_urlsrc)) {
$fp_localdst = fopen($localdst,"a");
fwrite ($fp_localdst, fread($fp_urlsrc, 1));
fclose ($fp_localdst);
}
fclose($fp_urlsrc);
}