У меня есть следующий код PHP:
<?php
# URL #1
$ch = curl_init('http://www.google.com/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
# get the content type
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
echo $content_type;
echo "<br>";
# URL #2
$ch = curl_init('http://www.lemonde.fr/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
# get the content type
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
echo $content_type;
?>
Возвращает следующий результат:
text / html charset = UTF-8
text / html
Так что мне не хватает кодировки для второго URL.Я проверил HTML-код и там есть кодировка.
Почему curl_getinfo не получает кодировку во втором случае?