echo file_get_contents('http://sbonhelp.ru/registraciya-v-sberbank-online');
$options = [
'http' => [
'method' => 'GET',
'header' => [
'Accept-language: ru',
'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 YaBrowser/19.3.1.828 Yowser/2.5 Safari/537.36'
]
]
];
$context = stream_context_create($options);
$response = file_get_contents('http://sbonhelp.ru/registraciya-v-sberbank-online', false, $context);
echo mb_convert_encoding($response, 'utf-8', 'windows-1251');
function getUrlContent($url) {
fopen("cookies.txt", "w");
$parts = parse_url($url);
$host = $parts['host'];
$ch = curl_init();
$header = array('GET /1575051 HTTP/1.1',
"Host: {$host}",
'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language:en-US,en;q=0.8',
'Cache-Control:max-age=0',
'Connection:keep-alive',
'Host:adfoc.us',
'User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36',
);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$url = "http://sbonhelp.ru/registraciya-v-sberbank-online";
$html = getUrlContent($url);
$opts = array('http' =>
array(
'method' => 'GET',
'header' => array(
'Accept-Language: ru-Ru,ru;q=0.8',
'User-Agent: '.$_SERVER['HTTP_USER_AGENT'],
)
)
);
$context = stream_context_create($opts);
echo file_get_contents('https://sbonhelp.ru/registraciya-v-sberbank-online', false, $context);