faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

21 of 40 people (53%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can i save an image from a remote web server to my web server?

Mar 1st, 2009 08:52
Sarah Turner, healthy man, dman, Articles Hosting, Pavel Prishivalko, Bjorn H,


Here's the snippet:
<?
$url_file = fopen("http://host/image.jpg",'rb');
$newfile_name = "/tmp/mydownload.file";
$newfile = fopen($newfile_name,'wb');
while (!feof($url_file)) {
  $chunk = fread($url_file,1024);
  fwrite($newfile,$chunk);
}
fclose($newfile);
fclose($url_file);
?>
in file "/tmp/mydownload.file" you will have the image you need
=========
openhosting.co.uk/articles/serverside/5854
http://www.healthdothealth.com
http://www.healthxhealth.com
http://www.mesotheliomainmesothelioma.com
http://www.healthfirewall.com
http://www.flathealth.com
http://www.healthbodyguard.com
http://voyagevacances.blogtact.com/
http://rejseferie.blogtact.com/
http://flyvningertilschweiz.blogtact.com/
http://volssuisse.blogtact.com/
http://volsromeitalie.blogtact.com/
http://viajesvacaciones.blogtact.com/
http://reisenchina.blogtact.com/
http://flugeschweiz.blogtact.com/
http://resasemester.blogtact.com/
http://viaggivacanze.blogtact.com/
http://reisenurlaub.blogtact.com/
http://reizenvakanties.blogtact.com/
http://volisvizzera.blogtact.com/
http://gartenpflege.blogtact.com/
http://geschenkideeen.blogtact.com/
http://vluchtenromeitalie.blogtact.com/