This function checks a URL from user input ($address) and then displays the site, along with it's title, but i need a regex to put the title in a variable ($str) to use later.
This line does not match:
$str = eregi("<title>[a-zA-Z0-9]{1,}$</title>$", $title);
function checkUrl($address) {
$web = @fopen("$address", "r");
if(!($web=@fopen("$address", "r")))
{
echo "Sorry, the site you suggested was not found.";
exit;
}
echo "Here is the site you suggested:<br>";
do {
$title = @fgets($web, 1024);
$title = eregi_replace(".<title>","",$title);
$title = eregi_replace("</title>.","",$title);
static $str;
$str = eregi("<title>[a-zA-Z0-9]{1,}$</title>$", $title);
echo $str;
echo $title;
} while (!feof($web));
fclose($web);
}
Is there a CORRECT way to define this eregi()?
Thanks so much!
--ph(p)