Re: Download a file with PHP
| From: | _lallous | Date: | Mon, 17 Sep 2001 11:20:16 +0000 |
| Subject: | Re: Download a file with PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67582@lists.php.net to get a copy of this message | ||
Very simple,
you can use functions like this to copy file from an HTTP server to your
local harddrive:
function my_copyfile($src, $dest)
{
if (!$fp = fopen($src, "rb"))
return;
$fpo = fopen($dest, "wb");
while (!feof($fp))
{
$t = fread($fp, 4096);
fwrite($fpo, $t, 4096);
}
fclose($fp);
fclose($fpo);
}
in combination with the use of RegExps to parse HTML pages and extract the
filenames that you want to extract....
"Erich Kolb" <ekolb@randbreceivables.com> wrote in message
news:000601c13d3b$3e0ba580$6b01a8c0@randbreceivables.com...
> How do I download a file with PHP? I have a few hundred .xml and .rdf
files
> that I want to download on a regular basis.
>