function curl_get($url, $referer = 'www.google.com') {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36");
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$html = curl_get('https://www.potehechas.ru/club/fact_1.shtml');
// file_put_contents('1.txt', $html);
echo $html;
#AddDefaultCharset UTF-8
AddDefaultCharset WINDOWS-1251
function curl_get($url, $referer = 'www.google.com') {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36");
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$body = iconv('windows-1251', 'UTF-8', $data);
return $body;
}
$html = curl_get('https://www.potehechas.ru/club/fact_1.shtml');
echo $html;
curl_setopt(CURLOPT_HTTPHEADER, array("Accept-Charset: WINDOWS-1251"));
if it helps...Find more questions by tags PHP