How you can save an image from url to your server

Hi guys! In this tutorial I will show you an easy way to save images from internet to your server. You can use this way to save images from XML files, CSV, etc.

First of all, you must use the file_get_contents function to get the image from url:

$imageurl = file_get_contents('imageurl');

Next, you must use the fopen function to create a new image:

$newimage = fopen("newimage.format","w");

Next, you must override the created image with $imageurl.

fwrite($newimage,$imageurl);

In this way you can save images from URL to your server!

Video tutorial:









Leave a Comment