I'm trying to get the image from Google Books service, in the thumbnail. Reading the address in php via file_get_contents get all the web page of the book while I just want to get the cover image. I know that it can be done via the src tag of html img element but I need the image server side. Is there a way? Thanks
Here the code I've used:
$context = [
'http' => [
'method'=>"GET",
'header' => "Accept:image/png\r\nAccept-Language:it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3\r\nCache-Control:max-age=0\r\nConnection: keep-alive\r\nUser-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:33.0) Gecko/20100101 Firefox/33.0\r\n"
]
];
$context = stream_context_create($context);
$result = @file_get_contents($bookThumbnail, false, $context);