header('Content-type: text/html; charset=utf-8');
header('Content-Encoding: gzip');
$url = "https://www.rusprofile.ru/id/11597949";
$file = file_get_contents($url);
echo($file);
<?php
header('Content-type: text/html; charset=utf-8');
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-Encoding: identity\r\n".
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36"
)
);
$context = stream_context_create($opts);
$html = file_get_contents('https://www.rusprofile.ru/id/11597949', false, $context);
echo $html;
function getcontents($url){
if(filter_var($url,FILTER_VALIDATE_URL)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
// ssl?
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
return file_get_contents($url);
}
echo getcontents('https://www.rusprofile.ru/id/11597949');
$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;
}
}