I am trying to save images using PHP code using cURL.
function scaleImageAndSaveIt($appName,$imageURL)
{
$format=time();
print_r($format);
//$strf=strftime($format);
$imageLocnName = $appName . "_" . $format ;
$ch = curl_init($imageURL);
print_r($imageURL);
$fp = fopen($imageLocnName, 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
//exit;
curl_exec($ch);
curl_close($ch);
fclose($fp);
}
when i am running this in browser it is giving garbage values on the screen and not saving the image also.
how do i save the image and what are those garbage values.