How to download image to your server using PHP?
Posted by Grady on Sep 20, 2011 in | 0 comments
I had been google-ing over this for a while, and couldn’t find the answer. Finally with some luck I found a way to download an image, and put it on your server. The code will look like this:
$imageUrl = "http://graph.facebook.com/" . $facebook . "/picture?type=large"; $filename = realpath(dirname(__FILE__))."/foo/foo.png"; $handle = file_get_contents($imageUrl); file_put_contents($filename, $handle);
