Possible Duplicates:
(PHP5) Extracting a title tag and RSS feed address from HTML using PHP DOM or Regex
Grabbing title of a website using DOM
I am trying to run through a hundred different html files on my server, and extract the titles for use in another php file.
For reference:
<title>Generic Test Page</title>
What I need is a function that will return the string "Generic Test Page" and stick that into a global variable.
What I am doing right now is simply reading the file into an array called $lines. Foreach $lines as $line, I am testing for the string < title> ... but how do I extract only what's between the > and < /title?
My trouble is that sometimes the original developer decided to elaborate on the title: < title name=title class=title1>, or he put it on three lines instead of one. What in the world? So I can't just strip the first seven characters and the last eight characters. Which would be so nice...
Thank you!!