我正在尝试获取网站的元标记。这是我的代码
$tags = get_meta_tags('https://www.wired.com/story/avengers-infinity-war-d23-footage');
print_r($tags); exit;
这返回空。任何的想法?
Wesbite 使用 gzip 之类的压缩。
最佳答案
你需要解压它,你可以使用stream wrapper为了。例如:
$tags = get_meta_tags('compress.zlib://https://www.wired.com/story/avengers-infinity-war-d23-footage');
print_r($tags);
输出:
Array
(
[viewport] => width=device-width, initial-scale=1
[content-type] => article
...
)
关于php - 获取元标记在 php 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45136267/