Friday, November 19, 2010

How can we save an image from a remote web server to my web server using PHP?

$file_rimg = fopen("http://w3answers /image23.jpg",'rb');
$newfile_name_img = "/tmp/tutorial.file";
$file_wnew = fopen($newfile_name_img,'wb');
while (!feof($file_rimg)) {
$chunk_rd = fread($file_rimg,1024);
fwrite($file_wnew,$chunk_rd);
}
fclose($file_wnew);
fclose(file_rimg);

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off