[EMAIL PROTECTED] (Andy Delcambre) wrote:
> I am a complete php newbie but i have a quick question. I was wondering if
> there is a way to copy a file from a remote site to your local server? I
> want to grab a picture off of a site and store it locally to be displayed
> later. Thanks alot,
use the fopen function to save the image to your local site, ex:
$fp = fopen("http://site.com/image.gif", "r");
$buffer = "";
while (!feof ($fp)) {
$buffer .= fgets($fp, 4096);
}
fclose($fp);
$fp = fopen("/local/file.gif", "wb");
fwrite($fp, $buffer);
fclose($fp);
untested but it should work (TM).
--
Henrik Hansen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php