Php Flow » Php

PHP: Extract All Meta Tags From A Webpage

PHP has built in function get_meta_tags() which extracts all meta tags of a webpage and returns an array.It takes a minimum of one parameter (the path of the webpage). which can be local or an external webpage from other site.

Meta tags provide the most basic elements used in search engine optimization and are used by all major search engines.

It parses the webpage line by line for meta and stops when it gets tag.

Its only extracts those meta which has name attribute set.

$metas = get_meta_tags(‘http://phpflow.com’);

echo “

";
print_r($metas);
echo "

“;

Did you enjoy this article? Share it!

About the Author:

Hi, This is Parvez Alam from India. I am software developer with 4 years’ experience in web development. I have submitted articles on PHP, Mysql, Magento,CSS, HTML, jQuery, web designing and social API. You can subscribe to my blog via RSS/Twitter/Google plus and Facebook. parvez1487(at)gmail(dot)com

Random Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>