HI,
I have this code that deletes any div that contains class = "comments-box"
$dom = new DOMDocument;
$dom->loadHTML($html, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
$xp = new DOMXPath($dom);
// get the node list of div nodes with "target" class
$spanNodeList = $xp->query('//div[contains(@class, "comments-box")]');
foreach ($spanNodeList as $spanNode) {
$spanNode->parentNode->replaceChild($spanNode->firstChild, $spanNode);
}
I need it to delete all the divs that it also contains
class = "heycomments-box"
class = "sdfcomments-box"
class = "comments-boxsdfdfh"
class = "sdgsdgcomments-boxsdfdfh"
Regards