This is my example script:
$html = <<
Capture this text 1
&l
try this
$dom = new DOMDocument();
$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$tags = $xpath->query('//div[@class="main"]');
foreach ($tags as $tag) {
$innerHTML = '';
$children = $tag->childNodes;
foreach ($children as $child) {
$tmp_doc = new DOMDocument();
$tmp_doc->appendChild($tmp_doc->importNode($child,true));
$innerHTML .= $tmp_doc->saveHTML();
}
var_dump(trim($innerHTML));
}
-Pascal MARTIN