php - DOMXPath var_dump: "(object value omitted)" -
this question has answer here:
- how parse , process html/xml in php? 27 answers
$store = curl_exec($ch); // returns page of html $doc = new domdocument(); $doc->loadhtml($store); $xpath = new domxpath($doc);
vardump $xpath
:
object(domxpath)#2 (1) { ["document"] => string(22) "(object value omitted)" }
what wrong here? i'm trying use xpath on html code extract info.
object(domdocument)#1 (34) { ["doctype"] => string(22) "(object value omitted)" ["implementation"] => string(22) "(object value omitted)" ["documentelement"] => string(22) "(object value omitted)" ["actualencoding"] => string(6) "gb2312" ["encoding"] => string(6) "gb2312" ["xmlencoding"] => string(6) "gb2312" ["standalone"] => bool(true) ...
loadhtmlfile
requires path of html file not content of html file loadhtmlfile. code be
$doc = new domdocument(); $doc->loadhtmlfile("path html file"); $xpath = new domxpath($doc);
edit
if want load html content use loadhtml
$doc = new domdocument(); $doc->loadhtml($store); $xpath = new domxpath($doc);
Comments
Post a Comment