Quantcast
Channel: How to remove all the anchor tags from content using PHP - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by user3559718 for How to remove all the anchor tags from content...

$xml = new DOMDocument(); $xml->loadHTML($html); $links = $xml->getElementsByTagName('a');//Loop through each <a> tags and replace them by their text content for ($i = $links->length -...

View Article



Answer by Leri for How to remove all the anchor tags from content using PHP

When parsing rss it's good idea to strip all tags and maintain those that are used for text formatting (<p>, <b>, <i>, etc.). So you need to pass second parameter to...

View Article

Answer by ThW for How to remove all the anchor tags from content using PHP

You can use the DOM function to modify the HTML or an XSLT to transform it. You need to be aware that loadHtml() will fix the HTML-DOM and add and elements. To get the fixed fragment, you will have to...

View Article

Answer by Dejan Marjanović for How to remove all the anchor tags from content...

Remove <a> element while keeping inner value.<?php$doc = new DOMDocument();$doc->loadHTML('<div><a href="#">text</a></div>');foreach...

View Article

How to remove all the anchor tags from content using PHP

I'm extracting content from an RSS feed, but it comes with anchor <a> tags which I need to remove.For this I tried strip_tags but it removed all HTML tags including <img>.Then I...

View Article

Browsing all 5 articles
Browse latest View live


Latest Images