This function extracts all the meta tags in the page. PHP also has a get_meta_tags function but it gives you only those meta tags which have a name attribute. Moreover, PHP's get_meta_tags finds only the last occurence of the tag as in if a keyword meta tag is more than one time in a page then it will not get reported.
This function takes care of all these issues. This function will not return array in a very formatted way. If you want to have a well formatted array just read my next post.
This function takes care of all these issues. This function will not return array in a very formatted way. If you want to have a well formatted array just read my next post.
<?php function extractAllMetaTags($content) { $pattern="/<meta(.*?)>/ims"; preg_match_all($pattern,$content,$matches); return $matches; } ?>
Comments
Post a Comment