<?php// Simple HTML DOM Parserinclude('simple_html_dom.php');$html = file_get_html('http://lifelearning.xtreemhost.com/'); foreach ($html->getElementsByTagName("ul",0)->getElementsByTagName("li") as $li){echo $li->plaintext; // works; but return the whole nodeValues (From "Point 1" to "Reference") echo $li->childNodes(0)->nodeValue; // return nothingecho "<br />";}?>
<ul><li>Point 1 <ul> <li>Point 1.1</li> <li>Point 1.2</li> <pre class="CodeDisplay"> some codes </pre> <li>Reference: <a href="link.html" target="_blank">link</a></li> </ul> </li> </ul>
I want to just thru PHP get the plain text of the first li ("Point 1").How can I do that in PHP?