How to cURL image-type projected image? [closed]

Tags: , , , ,



I have this problem.

There is a Joomla site that has a image presented via PHP file image.php that has some Content-Type to be projected as Image.

I want to get that image with cURL or file_get_contents and save it as .jpg file.

The URL Looks like: http://radioglos.pl/components/com_eventgallery/helpers/image.php?option=com_eventgallery&mode=full&view=resizeimage&folder=2020-12-12kielpino&file=_ZBG5132.jpg

It has image.php script that is projecting the passed image via GET parameter as Content-Type Image.

I’ve already tried standard file_get_contents() method aswell as all cURL methods described in this topic: Saving image from PHP URL

Looking for answers.

Answer

try to use file_put_contents() function

//Get the file
$content = file_get_contents("http://www.google.co.in/intl/en_com/images/srpr/logo1w.png");
//Store in the filesystem.
$fp = fopen("/location/to/save/image.png", "w");
fwrite($fp, $content);
fclose($fp);

from PHP – Copy image to my server direct from URL



Source: stackoverflow