PHP download images from URLs

With this lesson I am proving you that how to download images from a distant host to the local machine.

Please ensure that the remote server path has read and write permission. Change permission of folder in Ubuntu.

Here is code for downloading images from URLs

 function download_remote_file($file_url, $save_to) {  
   $content = file_get_contents($file_url);  
   file_put_contents($save_to, $content);  

 download_remote_file('',v' a/r/www/test/downloads/file.jpg');  

Again, “download” folder must be exists and writable.

Nikunj K

Phasellus facilisis convallis metus, ut imperdiet augue auctor nec. Duis at velit id augue lobortis porta. Sed varius, enim accumsan aliquam tincidunt, tortor urna vulputate quam, eget finibus urna est in augue.