我无法从某些网站获取元描述标签,尤其是你的管。
我尝试过使用“get_meta_tags”但是它没有返回描述。我也试过使用几个正则表达式。标题返回正常。
尝试从此链接获取说明:http://www.youtube.com/watch?v=xci0-26M-bk
$url = 'http://www.youtube.com/watch?v=xci0-26M-bk';
if ($fp = @fopen($url, 'r')) {
$file = file($url);
$file = implode("", $file);
$tags = get_meta_tags($url);
$description = trim($tags['description']);
}
$ description返回空白...
答案 0 :(得分:0)
为什么不直接将$ url放入get_meta_tags?
如果我这样做:
print_r(get_meta_tags('http://www.youtube.com/watch?v=xci0-26M-bk'));
我明白了:
Array ( [title] => Catfish Blues - Jimi Hendrix Experience [description] => Couldn't ignore Jimi any longer. This is a track recorded for Radio one about 1967. Love the simplicity (seemingly)and the, understated, power. [keywords] => Jimi, Hendrix, sixties )