I think you can find the first text node with something similar to the following...
foreach($html->find('.foo') as $foo)
echo $foo->find('text', 0);
Pregunta
I'm using SimpleHTMLDOM and trying to get some content from a site. And I must say that im very happy with using SimpleHTMLDOM, but I can't find anything on my problem and how to solve it.
The goes like this: I'm trying to extract the string from a follow element: foo.
This is the markup for element foo on the site:
<div class="foo">
Lorem Ipsum
<div class="bar"></div>
</div>
And the php code i'm using is like this:
foreach($html->find('.foo ') as $m)
$foo = $m->innertext;
This will output:
Lorem Ipsum <div class="bar"></div>
So my question is how to exclude the div/element inside the class foo?
Thanks in advance!
Solución
I think you can find the first text node with something similar to the following...
foreach($html->find('.foo') as $foo)
echo $foo->find('text', 0);