FOPEN For Getting Images From Another Site
| From: | Jeff Gannaway | Date: | Thu, 13 Jul 2000 10:23:33 +0000 |
| Subject: | FOPEN For Getting Images From Another Site | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6459@lists.php.net to get a copy of this message | ||
I tried this the way I thought it would work without any success.
I need to copy thousands of images form our suppliers' web site to our
retail web site. They've given us permission to do so, but won't let us do
it any simple way (FTP, sending us a CD ROM or ZIP disk, etc). I'd like to
save a day of headaches by writing a PHp scrip tthat will read the
filenames (which I already know) and save them on my server. I tried using
this method to read them:
<?
$filename = "http://www.theirsite.com/graphics/imagename.jpg";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
$x = filesize($filename);
print "x = $x<BR>
$contents";
fclose ($fd);
?>
x (the filesize) came up as null value and it didn't display the contents.
Am I dreaming, or is this possible?
Thanks,
Jeff