I have source code :
<li class="parent">
<a href="#">F</a>
<ul>
<li>xx</li>
<li>xx</li>
......
</ul>
</li>
I want get plaintext
of tag li:nth-child(1)
by simple_html_dom :
$html->find("li.parent li:nth-child(1)")
not
$html->find("li.parent li",0);
You can't use complicated css with simple html dom. I suggest switching to this one:
$html = <<<EOF
<li class="parent">
<a href="#">F</a>
<ul>
<li>xxx</li>
<li>yyy</li>
</ul>
</li>
EOF;
require_once('advanced_html_dom.php');
$doc = str_get_html($html);
echo $doc->find("li.parent li:nth-child(2)", 0)->text;
// yyy