Check for errors at HTML parsing

This commit is contained in:
Phyks 2014-07-18 23:13:33 +02:00
parent ce15802830
commit 6774e880ed
1 changed files with 7 additions and 1 deletions

View File

@ -47,8 +47,14 @@ function getFavicon($urls) {
$html = new DOMDocument();
$html->strictErrorChecking = false;
@$html->loadHTML($content);
$success = @$html->loadHTML($content);
if($success === false) {
continue;
}
$xml = simplexml_import_dom($html);
if($xml === false) {
continue;
}
// Try to fetch the favicon URL from the <head> tag
foreach($xml->head->children() as $head_tag) {