How to retrieve the text using DOMDocument()

Is there a method for either the DOMDocument() or DOMElement class to retrieve the text inside a tag.

i can get the tags attributes using getAttribute() but i have looked through the docs and can’t find the method to get the text inside the tag

any help is appreciated

Try $node->nodeValue :wink:

When looking through the docs, remember that many classes extend others (e.g. DOMElement extends from DOMNode) and not all of them list all of the inherited properties and/or methods (and those that do, generally only show the members inherited from their immediate parent class).

With regard to your question, as Anthony mentioned, there is the nodeValue property which gives the node’s value (what that is, varies depending on the node) and there is also the textContent which contains the text content of the node and its descendants.

great stuff, thanks to you both