This is a sample html code:
<div class="leadContent">
<span> sentence 1 </span>
sentence 2
</div>
I just want to get sentence 2 (Not span tag and its content)
Is there any way to do this with simple_html_dom?
$html->find('div.leadContent', 0)->innertext;
You can remove span tag using outertext:
$html->find('div.leadContent span', 0)->outertext = '';
then you get the content
$html->find('div.leadContent', 0)->innertext;
edit:
You can also try this way:
$div = $html->find('div.leadContent', 0);
$div->find('span',0)->outertext = '';
$div
will have your content.