Meta tag grabber

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
virtualone
Forum Newbie
Posts: 1
Joined: Fri Nov 10, 2006 6:38 am

Meta tag grabber

Post by virtualone »

well i am trying to get meta tags from a given URL.. i came up with this code ..
<?php
$URL = 'http://www.yahoo.com';

$meta_tags = get_meta_tags($URL) or die("Could not fetch meta tags for $URL");

print_r($meta_tags);
?>

but this code always fails .. why ? any better idea?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
echo 'allow_url_fopen: ', ini_get('allow_url_fopen') ? 'on':'off', "<br />\n";

$URL = 'http://www.yahoo.com';
$meta_tags = get_meta_tags($URL) or die("Could not fetch meta tags for $URL");
print_r($meta_tags);
?>
and post the output, esp. error/warning messages.
Post Reply