eregi not working???
| From: | Clayton Dukes | Date: | Tue, 20 Mar 2001 22:16:55 +0000 |
| Subject: | eregi not working??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-44833@lists.php.net to get a copy of this message | ||
I have a script that looks for <title> tags, but it doesn't seem to be picking up the
titles, can anyone tell me why?
Almost all of the web pages look like:
<?
if(!isset($mainfile)) { include("mainfile.php"); }
if(!isset($headers_sent)) { include("header.php"); }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Some Title</TITLE>
<META NAME="Author" CONTENT="Some Name">
</HEAD>
<BODY>
Here's my function:
function getTitle(&$doc)
{
if (eregi("<title>(.*)</title>", $doc, $titlematch))
$title = trim(eregi_replace("[[:space:]]+", " " ,
$titlematch[1]));
else
$title = "";
if ($title == "")
$title = "Untitled Document";
return $title;
}
it runs okay...
But, when I use the function, everything is coming back as "Untitled Document".
Any suggestions?
Clayton Dukes
---------------------------------------------------------------------
Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net