Location: PHPKode > scripts > HTML Count > html-count/example.php
/**********************************************************************
# 
# mahesh v more
# hide@address.com
# hide@address.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>";

?>
Return current item: HTML Count