1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-27 15:50:09 +02:00

Merge pull request #670 from mmjjb/patch-1

Update URL function, with browser headers
This commit is contained in:
Oliver Vogel
2017-01-20 18:19:25 +01:00
committed by GitHub

View File

@@ -61,6 +61,17 @@ abstract class AbstractDecoder
*/
public function initFromUrl($url)
{
$options = array(
'http' => array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n".
"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n"
)
);
$context = stream_context_create($options);
if ($data = @file_get_contents($url)) {
return $this->initFromBinary($data);
}