i'm using PHP Simple HTML DOM Parser to get text from a webpage. The page i need to manipulate is something like:
<html>
<head>
<title>title</title>
<body>
<div id="content">
<h1>HELLO</h1>
Hello, world!
</div>
</body>
</html>
I need to get the h1
element and the text that has no tags.
to get the h1
i use this code:
$html = file_get_html("remote_page.html");
foreach($html->find('#content') as $text){
echo "H1: ".$text->find('h1', 0)->plaintext;
}
But the other text? I also tried this into the foreach but i get the full text:
$text->plaintext;
but it returned also the H1
tag...