Read And Write Image PHP
function save_image($url,$filename){
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata=curl_exec ($ch);
curl_close ($ch);
$fp = fopen($filename,’w');
fwrite($fp, $rawdata);
fclose($fp);
}
When you run this function and get error call undefined function curl_init you must enable curl php extension in php.ini file.