I am getting an error on trying to remove nodes within xhtml.
The code is:
foreach($post->getElementsByTagName('a') as $key=>$a)
{
$post->removeChild($a);
}
Fatal error: Uncaught exception 'DOMException' with message 'Not Found Error' in /var/www/content.php(24): content->fetch() #2 {main} thrown in /var/www/content.php on line 192
If i use img tag instead, it removes all but one img nodes and no fatal errors.
What is going on here?
try:
$a->parentNode->removeChild($a);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With