X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/a456368741ffa03a63f9ebeaacc90d5e3a811f52..ada5b21e333298cb88152d51cb4ca30e8b13f56b:/src/phorkie/HtmlParser.php diff --git a/src/phorkie/HtmlParser.php b/src/phorkie/HtmlParser.php index 38d8af8..8102c69 100644 --- a/src/phorkie/HtmlParser.php +++ b/src/phorkie/HtmlParser.php @@ -92,11 +92,13 @@ class HtmlParser //$sx = simplexml_load_file($url); libxml_use_internal_errors(true); + $domDoc = new \DOMDocument(); if ($html === null) { - $sx = simplexml_import_dom(\DOMDocument::loadHTMLFile($url)); + $domDoc->loadHTMLFile($url); } else { - $sx = simplexml_import_dom(\DOMDocument::loadHTML($html)); + $domDoc->loadHTML($html); } + $sx = simplexml_import_dom($domDoc); //FIXME: handle network error $elems = $sx->xpath('//*[@rel="vcs-git"]'); @@ -174,6 +176,8 @@ class HtmlParser public function getHtmlTitle($url) { libxml_use_internal_errors(true); + //allow loading URLs in DOMDocument + libxml_disable_entity_loader(false); $doc = \DOMDocument::loadHTMLFile($url); if ($doc === false) { return null;