Мне помог вот такой код:
$url = 'https://www.kinopoisk.ru/';
$options = [
'http' => [
'method' => 'GET',
'header' => 'user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
];
$context = stream_context_create($options);
$resp = file_get_contents($url, false, $context);
foreach($http_response_header as $c => $h) {
if(stristr($h, 'content-encoding') and stristr($h, 'gzip')) {
$resp = gzinflate(substr($resp, 10, -8));
break;
}
}