note 92197 added to function.get-meta-tags
| From: | jstel at 126 dot com | Date: | Tue, 14 Jul 2009 04:36:29 +0000 |
| Subject: | note 92197 added to function.get-meta-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158258@lists.php.net to get a copy of this message | ||
this function could get each meta of html content , and stripped all js and css.
function get_meta_data($content)
{
$content = strtolower($content);
$content =
preg_replace("'<style[^>]*>.*</style>'siU",'',$content);
// strip js
$content =
preg_replace("'<script[^>]*>.*</script>'siU",'',$content);
// strip css
$split = explode("\n",$content);
foreach ($split as $k => $v)
{
if (strpos(' '.$v,'<meta')) {
preg_match_all(
"/<meta[^>]+(http\-equiv|name)=\"([^\"]*)\"[^>]" .
"+content=\"([^\"]*)\"[^>]*>/i",
$v, $split_content[],PREG_PATTERN_ORDER);;
}
}
return $split_content;
}
----
Server IP: 221.194.139.225
Probable Submitter: 114.255.44.132
----
Manual Page -- http://www.php.net/manual/en/function.get-meta-tags.php
Edit -- https://master.php.net/note/edit/92197
Del: integrated -- https://master.php.net/note/delete/92197/integrated
Del: useless -- https://master.php.net/note/delete/92197/useless
Del: bad code -- https://master.php.net/note/delete/92197/bad+code
Del: spam -- https://master.php.net/note/delete/92197/spam
Del: non-english -- https://master.php.net/note/delete/92197/non-english
Del: in docs -- https://master.php.net/note/delete/92197/in+docs
Del: other reasons-- https://master.php.net/note/delete/92197
Reject -- https://master.php.net/note/reject/92197
Search -- https://master.php.net/manage/user-notes.php