note 107187 deleted from function.get-meta-tags by danbrown
| From: | danbrown@php.net | Date: | Sat, 14 Jan 2012 16:24:07 +0000 |
| Subject: | note 107187 deleted from function.get-meta-tags by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185658@lists.php.net to get a copy of this message | ||
Note Submitter: johnk at riceball dot com
----
This is similar to jstel's function, except that it returns one meta tag per array element.
<?php
function getMetaData($content)
{
$content =
preg_replace("'<style[^>]*>.*</style>'siU",'',$content);
// strip js
$content =
preg_replace("'<script[^>]*>.*</script>'siU",'',$content);
// strip css
preg_match_all("/<meta[^>]+(http\-equiv|name|property)=\"([^\"]*)\"[^>]"
.
"+content=\"([^\"]*)\"[^>]*>/i",
$content, $split_content,PREG_SET_ORDER);
return $split_content;
}
?>