$location = "http://www.geoplugin.net/php.gp?ip=115.67.131.206";
$geoplugin = unserialize(file_get_contents($location));
$country = $geoplugin['geoplugin_countryName'];
$city = $geoplugin['geoplugin_city'];
我在IIS上运行上面的PHP代码(来自Geoplugin的一个例子),它完美地工作,返回国家&城市;但是,从公共托管服务器运行时,不会返回任何内容,也不会显示错误。我错过了什么?PHP geoplugin在公共服务器上失败
东西检查配置http://php.net /manual/en/filesystem.configuration.php#ini.allow-url-fopen –
在开始处添加此代码并再次运行。 '的error_reporting(-1); ini_set('display_errors',1); ini_set('display_startup_errors',1);'你会看到错误 –