Check for errors at HTML parsing
This commit is contained in:
parent
ce15802830
commit
6774e880ed
@ -47,8 +47,14 @@ function getFavicon($urls) {
|
|||||||
|
|
||||||
$html = new DOMDocument();
|
$html = new DOMDocument();
|
||||||
$html->strictErrorChecking = false;
|
$html->strictErrorChecking = false;
|
||||||
@$html->loadHTML($content);
|
$success = @$html->loadHTML($content);
|
||||||
|
if($success === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$xml = simplexml_import_dom($html);
|
$xml = simplexml_import_dom($html);
|
||||||
|
if($xml === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Try to fetch the favicon URL from the <head> tag
|
// Try to fetch the favicon URL from the <head> tag
|
||||||
foreach($xml->head->children() as $head_tag) {
|
foreach($xml->head->children() as $head_tag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user