I run command like
wget https://odis.homeaway.com/odis/listing/5895882c-6c65-47f5-b782-e13b8246e4aa.c10.jpg
I try to get above image using curl, the returned image is invalid jpg image. When I try with browser and save image as, I get valid jpg image. Even when I try with file_get_contents it returns false.
$image = 'https://odis.homeaway.com/odis/listing/5895882c-6c65-47f5-b782-e13b8246e4aa.c10.jpg'
$image_data = file_get_contents($image);
try {
echo 'saving';
$image1 = imagecreatefromjpeg($image_data);
} catch (Exception $ex) {
echo 'error';
}
How to get this image with curl
, wget
, or file_get_contents
?