a.php:
<ul id="ul1">
<li id="pt1">Point 1
<ul id="ul2">
<li id="pt11">Point 1.1</li>
<li id="pt12">Point 1.2</li>
<pre class="CodeDisplay">
some codes
</pre>
<li id="ref">Reference: <a href="link.html" target="_blank">link</a></li>
</ul>
</li>
</ul>
I would like to get the nodeValue "Point 1" only. In JS, it is:
alert(document.getElementsByTagName("li")[0].childNodes[0].nodeValue);
But I would like to get the nodeValue in PHP (Simple HTML Dom); Here's the code snippet in another PHP page (b.php):
<?php
include('simple_html_dom.php');
$html = file_get_html('http://lifelearning.net63.net/a.php');
// stuck here:
echo $html->getElementsByTagName('ul',0)->getElementsByTagName('li',0)->nodeValue;
//
?>
I have used textContent but it just extracts the content descendents under Point 1. This is not what I want. I only want "Point 1". Any help is appreciated!