2013-05-20 42 views
0

我有这个链接http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=获取Meta标签不起作用

,并返回meta标签

<meta name="known" content="true">

<meta name="internet" content="EN"> 

等。在页面上我试过这个

<?php 

$tags = get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress='); 


print $tags['city']; // city name 


?> 

不工作,并返回一个白页为什么?

+0

你是否曾经激活错误报告? –

+0

使用以下代码:ini_set(“error_reporting”,E_ERROR | E_WARNING | E_PARSE | E_NOTICE); echo ini_get(“error_reporting”);返回错误号4181 – Federal09

+0

从'echo ini_get'中删除'echo'。你可以添加'print_r($ tags)'来查看是否有任何数据被发送? –

回答

0

尝试使用:

print_r(
    get_meta_tags("http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=") 
); 
+0

你的代码返回所有标签,我只需要标签城市 – Federal09

+0

$ tags = get_meta_tags('http:// www。 geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress='); echo $ tags ['city'];工作 – Federal09