Last active
June 10, 2016 06:03
-
-
Save hsleonis/314f463e823139aca261ef0d3fff4257 to your computer and use it in GitHub Desktop.
get_meta_tags — Extracts all meta tag content attributes from a file and returns an array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
array get_meta_tags ( string $filename [, bool $use_include_path = false ] ) | |
(PHP 4, PHP 5, PHP 7) | |
ref.: http://php.net/manual/en/function.get-meta-tags.php | |
*/ | |
// Assuming the above tags are at www.example.com | |
$tags = get_meta_tags('http://www.example.com/'); | |
// Notice how the keys are all lowercase now, and | |
// how . was replaced by _ in the key. | |
echo $tags['author']; // name | |
echo $tags['keywords']; // php documentation | |
echo $tags['description']; // a php manual | |
echo $tags['geo_position']; // 49.33;-86.59 | |
// Only meta tags with name attributes will be parsed. Quotes are not required. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment