I have a picture url like this http://www.address.com/image.jpg
I want do dynamically save this image on my server
How can i achieve this using php
Thanks
I have a picture url like this http://www.address.com/image.jpg
I want do dynamically save this image on my server
How can i achieve this using php
Thanks
You can get it using file_get_contents()
and saving it using file_put_contents()
. Something like:
$image = file_get_contents('http://www.address.com/image.jpg');
file_put_contents('image.jpg', $image);
You also might want look into cURL to fetch the image; it should perform better than file_get_contents()
(unless you compile curl with --with-curlwrappers
)