I whant to extract the content betwin the tags from html file with DOM.
source file:
<html>
<body>
some html code
..........
<div id="text">
<p>some title</p> <br>
<p>some text</p> <br>
<img src="../images2/somegif.gif">
<div>
..........
</body>
</html>
my code:
$file = 'somefile.html';
include('simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file($file);
$text = $html->getElementById('text');
echo $text;
the result is:
<div id="text">
<p>some title</p> <br>
<p>some text</p> <br>
<img src="../images2/somegif.gif">
<div>
What I want is just the data inside the div tags but keeping all the other HTML elements like:
<p>some title</p> <br>
<p>some text</p> <br>
<img src="../images2/somegif.gif">
How can I do that? ...I need that data to send to a mysql DB later on. Thank you.