Posted on November 25th, 2006
3885 views
Meta Tags? - WTF are those?
Meta Tags are information placed on web pages that provide a summary or description of the content present on that page. It can contain a lot of information, author of the page, keywords, the works! They are usually read by search engines such as the Google Bot and soon to come, the SeekBot. If you view the page of a website, placed in between the <head> tags would be meta information. The Run Down There is a handy function already embedded into the PHP library called geT_meta_tags(); With this function, we are able to extract all the meta tag information from any web page or file. The returned data will be stored into an array, where the name of the meta tag will become the key of the array, and the value of that meta tag will become the value. The Snippet [code=PHP]<?php // Enable pre formatting echo '<pre>'; // Get meta information of "http://www.pixel2life.com" $meta = get_meta_tags ( 'http://www.pixel2life.com' ); // Print the array print_r ( $meta ); ?>[/code] You can also grab meta tags from local files as well. For example: /home/jamie/public_html/index.html Results When that code is ran on the url, our example being Pixel2Life, you would get an output similar to the following: Array A closer look Looking at the source of the web page, you can see that the meta information is in fact correct, presented below: <meta name="author" content="Pixel2life.com" /> The utility of this function may not be at the maximum, but websites that provide SEO tools will generally have meta extractors, in which you can dig up the meta tags of a webpage without getting your hands dirty. |