PHP - Parse title portion of files in a directory

home ~ tools ~ song quotes ~ podcast ~ song lyric trivia ~ docs ~ links ~ archives ~ search ~ lycii ~ mail
internetbumperstickers.com
/* open this directory */
$handle = @opendir(".") or die("Unable to open this directory");

/* loop through files in directory */
while (false!==($file = readdir($handle))) {

/* watch out for . and .. */
   if ($file != "." && $file != ".." && $file != "index.html") {
   	  $fp = fopen($file,r);
	  $fptext = fread($fp,200);
	  $fptext = str_replace("<","",$fptext);
	  $fptext = str_replace(">","",$fptext);
	  $startnum = strpos($fptext,"title") + 5;
	  $endnum = strpos($fptext,"/title") - $startnum;
	  $hreftitle = substr($fptext,$startnum,$endnum);
	  print("".$hreftitle."
"); } } /* close the directory */ closedir($handle);