looking for light weight tool/API/script(in PHP) to validate whether a html code snip
I am looking for light weight tool/API/script(in PHP) to validate whether a html code sippet is 'tidy'.By 'tidy' I simply mean whether the html snippet has properly closed tags and is valid html.
the tools that are usually ailable are generally for validating a url html. I wnat to be able to validate only a small html snippet . e.g
the above is invalid as the tag does not close properly
<a href="xyz.com" Click Here </a>
is valid .
<span> my name is xyz</span>
What would be the best way to validate html snippets? Thanks in advance for your help.