I need to remove some code from file with DOMxpath query:
<div ="firstClass"> Some content <div class="AnyrandomClass" id="AnyrandomClass"> Div content </div> </div>
$doc->loadHTML($FilePath); $doc->normalizeDocument(); $xpath = new DOMXpath($doc); $x = $xpath->query('//*[@id="firstClass"]'); echo $doc->saveHTML($x->item(0));
It working fine, but I do not want to show the second inter div, how may I do this ?
I tried also with Purifier I could not find a way with it, so how may I ?
Should I user preg_replact,match ?!