Всем привет! Подскажите, пож, пытаюсь парсить страницу сайта
function send_http($url, $ua)
{
$ch = curl_init($url);
$headers = [
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: ru-RU,en;q=0.5',
"Host: " . parse_url($url) ["host"],
'User-Agent: ' . $ua,
];
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
$html = curl_exec($ch);
if (curl_errno($ch)) {
print "Error: " . curl_error($ch);
exit();
}
curl_close($ch);
return $html;
}
$page = send_http('https://link/', get_ua());
Суть в том, что сайт автоматически перенаправляется на link/ua (украинскую версию сайта) и curl забирает именно эту украинскую версию, а мне нужно парсить link. Как передать команду парсингу, чтобы русскоязычную версию забирал?