aw ok... sorry mao akong pagsabot. hehe ^___^
its quite simple really... i have written a quick and dirty php code of what you're looking for. it involves three files.
1- html form (incase you want it to be submitted) (html_submit.html)
2- an html obfuscater written in php (check_tags.php)
3- a sample html file for your html obfuscater (sample.html)
html_submit.html
Code:
<html>
<head>
<title>Check HTML Tags</title>
</head>
<body>
<form action="check_tags.php" method="post" enctype="multipart/form-data" target="_parent">
<input name="file" type="file" id="file">
<input type="submit" name="Submit" value="Submit" />
</form>
</body>
</html>
check_tags.php
Code:
<?
$htmlFile = $_FILES['file']['name'];
echo "<p>Checking $htmlFile...</p>";
$handle = fopen($htmlFile, "r");
$contents = stripslashes(fread($handle, filesize($htmlFile)));
fclose($handle);
$openFile = strtok($contents, "<");
$open = 0;
$close = 0;
$count = 0;
while ($openFile !== false)
{
if (strstr($openFile, ">"))
{
$x = substr($openFile, 0, strpos($openFile, ">"));
if (strstr($x, "/")) { $close++; }
else { $open++; }
}
$openFile = strtok("<");
$count++;
}
echo "There are $open open tags.<br>";
echo "There are $close close tags.<br>";
echo "Total tags found: $count<br><br>";
if ($open !== $close)
{
if ($open>$close) $i = $open-$close;
echo "Warning there are $i unclosed tag/s.";
}
?>
sample.html
Code:
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<p> Some table... </p>
<table>
<tr>
<td>Row1</td>
<td>Row2</td>
<td>Row3</td>
</tr>
</table>
<p>Some text...</p>
<p><a href="#link">Broken link</p>
</body>
</html>
Note: there is an unclosed anchor tag in this sample.