I want to get the innerHtml from an element, with simple html dom parser.
For example:
$s = " <div class="a">
<p>I don't want this stuff</p>
<div class="b">
<input type="button" value="testing">
<p>I want this stuff</p>
</div>
</div> ";
$html = str_get_content($s);
$ret = $html->find('div[class=b']);
Now ... I want to initialize another object, but with the html from $ret.
I've tried with $newSource = $ret[0]->save(), but it's not working. In their documentation it doesn't appear something about innerHtml or outerHtml, just innerText.
According to the documentation there is a way to dump your dom, maybe that can be used as wenn to dump just a part of your some.
echo $ret[0]; // this should return your dom fragment
if you want another object and $object = $ret[0]
isn't what you're looking for, this could help:
$html = (string) $ret[0]; // convert to html
$newSource = str_get_content($html); // create new object