Fetching Data from var_dump
Question
My var_dump
is giving me:
object(QueryPath)#2 (7) {
["errTypes":"QueryPath":private]=> int(257)
["document":protected]=> object(DOMDocument)#3 (34) {
["doctype"]=> string(22)"(object value omitted)"
["implementation"]=> string(22) "(object value omitted)"
["documentElement"]=> string(22) "(object value omitted)"
["actualEncoding"]=> string(5) "UTF-8"
["encoding"]=> string(5) "UTF-8"
["xmlEncoding"]=> string(5) "UTF-8"
["standalone"]=> bool(true)
["xmlStandalone"]=> bool(true)
["version"]=> NULL
["xmlVersion"]=> NULL
["strictErrorChecking"]=> bool(true)
["documentURI"]=> string(26) "http://www.therock.net.nz/"
["config"]=> NULL
["formatOutput"]=> bool(false)
["validateOnParse"]=> bool(false)
["resolveExternals"]=> bool(false)
["preserveWhiteSpace"]=> bool(true)
["recover"]=> bool(false)
["substituteEntities"]=> bool(false)
["nodeName"]=> string(9) "#document"
["nodeValue"]=> NULL
["nodeType"]=> int(13)
["parentNode"]=> NULL
["childNodes"]=> string(22) "(object value omitted)"
["firstChild"]=> string(22) "(object value omitted)"
["lastChild"]=> string(22) "(object value omitted)"
["previousSibling"]=> NULL
["attributes"]=> NULL
["ownerDocument"]=> NULL
["namespaceURI"]=> NULL
["prefix"]=> string(0) ""
["localName"]=> NULL
["baseURI"]=> NULL
["textContent"]=> string(48034)
}
}
How would I pull ["textContent"]
?
My current index page is:
$loadRock = $system->get_theRock();
var_dump($loadRock);
Solution
Try $loadRock->html(); or $loadRock->text();
OTHER TIPS
textContent
is a property of DOMDocument
object, which is the property document
, but this property is protected
, so you can't get it through $loadRock->document->textContent
.
You need to check the document of QueryPath
, see whether there is a method for access the document
property or something else.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow