/**********************************************************************
#
# mahesh v more
# maheshmore79@yahoo.com
# mahesh.more@solversa.com
#
***********************************************************************/
<?php
# parser class
include_once('html_count_class.php');
#html file to parse
#either local file
$file = "test.html";
#or remote file
//$file = "http://www.geocities.com/maheshmore79/home.html";
//$file = "http://www.phpclasses.org";
echo "Counting for HTML page ".
"<font color=blue>".$file."</font>";
#pattern for matching
#for mathcing img tag
//$pattern = '/<(img|input)\s+[^>]*src\s*=\s*(?:"([^"]+)"|\'([^\']+)\'|([^\s>]+))/is';
#for mathcing a tag
$pattern = '/<(a|input)\s+[^>]*href\s*=\s*(?:"([^"]+)"|\'([^\']+)\'|([^\s>]+))/is';
# new object of class ( filename & pattern )
$html = new html_count($file,$pattern);
# print out the result
echo "<br>";
echo "Count result is : " ;
echo "<font color=red>";
echo $html->count;
echo "</font>";
?>
|