Alternative of html purifier
<p>I want to accept to accept the html input from user and post it on my site also want to make sure that it don't create problem with my site template due to dirty html code. </p>

<p>I was using html purifier in the past but Html purifier is not working on one of my server. So I am searching for best alternative.
Which is purely written in php. 
 which can fix the dirty html code like </p>

<pre><code>&lt;/div&gt; it is dirty code as div is closed without opening. 
</code></pre>
