PhP to get meta data from a website
May 05, 2010
ImaDork, so i can remember how and why i did it, Web Html, php, other Comments Off
Share on Facebook
I have to say this is freakin sweet, especially if you have a links page to capture description data, etc. Here is the code
<?php
// Assuming the above tags are at www.example.com
$tags = get_meta_tags(‘http://www.putAwebsiteInHere.com/’);
// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
echo ‘author=’.$tags[‘author’].'<br><br>'; // name
echo ‘keywords=’.$tags[‘keywords’].'<br><br>'; // php documentation
echo ‘description=’.$tags[‘description’].'<br><br>'; // a php manual
echo ‘geo_position=’.$tags[‘geo_position’].'<br><br>'; // 49.33;-86.59
?>