note 28649 added to function.get-meta-tags

From: Date: Sun, 19 Jan 2003 17:15:25 +0000
Subject: note 28649 added to function.get-meta-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-42389@lists.php.net to get a copy of this message
ok i am not a pro. i have been up all night working this code. is a working example. utilizes named arrays insted of numbered arrays. looked all over here to get a good example of making a named arry and seen nothing. if anyone has a better quicker way of the email me on it. this code kind of lags but with fsockopen it ran a little quicker. <? $contents=file("thewebsite or file"); $contents=implode('',$contents); $file1=strtolower($contents); $file2=explode("<head",$file1); $file3=explode("head>",$file2[1]); $file4= "<head".$file3[0]."head>"; $text=preg_replace("/<head>/", "",$file4); $text=preg_replace("/<\/head>/", "",$text); $text=preg_replace("'<title[^>]*?>.*?</title>'si", "",$text); $text=preg_replace("/<meta/", "",$text); $text=preg_replace("/>/", "<br>",$text); $text=preg_replace("'<br>\r\n<link[^>]*?>.*?\r\n'si", "<br>",$text); $text=preg_replace("/name=\"/", "",$text); $text=preg_replace("/http-equiv=\"/", "",$text); $text=preg_replace("/\" content=\"/", "=",$text); $text=preg_replace("/\"/", "",$text); $text=preg_replace("/<br>/", "",$text); $text=preg_replace("/ /", "",$text); $text=preg_replace("/;/", "\r\n",$text); $text=trim($text); $lines=explode("\r\n",$text); /*here we take the contents of text and convert it to named arrays. /* foreach ($lines as $key => $value){ list($key,$value)=explode("=",$value); $meta[$key]=$value; } echo $meta['title']; ?> -- http://www.php.net/manual/en/function.get-meta-tags.php http://master.php.net/manage/user-notes.php?action=edit+28649 http://master.php.net/manage/user-notes.php?action=delete+28649 http://master.php.net/manage/user-notes.php?action=reject+28649

« previous php.notes (#42389) next »