я использую file_get_contents()
функция, чтобы получить две веб-страницы от Google. Мой код:
var_dump(htmlspecialchars(html_entity_decode(file_get_contents('https://www.google.com/search?q=moscow+russia&start=30'))));
var_dump(htmlspecialchars(html_entity_decode(file_get_contents('https://www.google.com/search?q=ice&start=00'))));
file_get_contents
Функция работает для первого URL, но не работает для второго URL. В чем проблема?
Это потому, что есть персонаж, который не может быть обработан htmlspecialchars
, file_get_contents
работает.
Пытаться ENT_SUBSTITUTE
опция:
var_dump(htmlspecialchars(html_entity_decode(file_get_contents('https://www.google.com/search?q=moscow+russia&start=30'))));
https://secure.php.net/manual/en/function.htmlspecialchars.php
Других решений пока нет …