X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/38aa0dc6133ff53d20fd9f714eb380809c8dba67..ada5b21e333298cb88152d51cb4ca30e8b13f56b:/src/phorkie/HtmlParser.php diff --git a/src/phorkie/HtmlParser.php b/src/phorkie/HtmlParser.php index b8cd1af..8102c69 100644 --- a/src/phorkie/HtmlParser.php +++ b/src/phorkie/HtmlParser.php @@ -92,11 +92,14 @@ 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"]'); $titles = $sx->xpath('/html/head/title'); @@ -173,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;