Thanks for everyone's help. Problem is still there.
Here is my function, I have tried many variations.
function safeHTML($text)
{
$text = substr( $text, strpos ( $text, "<body" ) );
$text = eregi_replace("[[:space:]]+", " ", $text);
$text = str_replace( "<h1>", "<h3>", $text );
$text = str_replace( "</h1>", "</h3>", $text );
$text = str_replace( "<p ", "<p><x ", $text );
$text = str_replace( "<b ", "<b><x ", $text );
$text = str_replace( "> <", "", $text );
$text = strip_tags( $text, '<b><i><u><a><h3><p><br>');
$text = str_replace( "<p>  </p>", "", $text );
//$text = str_replace( "<p> ", "", $text );
//$text = str_replace( "<p> </p>", "", $text );
//$text = str_replace( "<p> </p>", "", $text );
//$text = str_replace( "<p> ", "", $text );
//$text = eregi_replace("<p>[[:space:]]+</p>", "", $text);
//echo strpos( $text, "<p> </p>" );
return $text;
}
Here is a link to the file that needs to be stripped of codes.
http://www.iodis.com/example_files/example2.htm
As you can see after the file is processed, there is still a <p> </p> section that causes problem in the display, ie. it is not wanted there. I appreciate anyone's help. I feel this is not a trivial problem. Kudo's to the guy who figures it out.
Thanks,
Randy