I am trying to get the title of an html file... you know, the string 
between the < title > and < /title > tags...

Here is the function I've got so far:

function fileTitle($fileName) {
         $myFile = fopen($fileName, "r");
         while (!feof($myFile)) {
                 $myText .= fgets($myFile,255);
         if (eregi("<TITLE>(.+)</TITLE>",$myText,$theTitle)) return 
         else return "(No Title)";

The trouble is, it always returns "(No Title)", regardless of whether the 
file has a title defined in the header or not.

I suspect I'm doing something fundamentally wrong.  Can anyone set me straight?

Richard S. Crawford

AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
"It is only with the heart that we see rightly; what is essential is 
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to