rss search

How to download image to your server using PHP?

line How to download image to your server using PHP?

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);

0 comments

line

Trackbacks/Pingbacks

  1. Mac - Movies... [...]How to download image to your server using PHP? | Grady Laksmono[...]...

Leave a Reply

You must be logged in to post a comment.