How to fix dirty HTML code with PHP


/ Published in: PHP
Save to your folder(s)

This PHP class lets you clean and repair html code. WHAT IT DOES: delete closed tags without their opening tag, fix open tag without close, closing them automatically, check bad nesting and fix them, fix bad quotes in attributes, merge different styles attributes in the same tag, remove html comments, remove empty tags and more bad tags.


Copy this code and paste it in your HTML
  1. /*
  2.   download the class from:
  3.   http://www.barattalo.it/html-fixer/
  4. */
  5.  
  6. $dirty_html = ".....bad html here......";
  7.  
  8. $a = new HtmlFixer();
  9. $clean_html = $a->getFixedHtml($dirty_html);

URL: http://www.barattalo.it/html-fixer/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.