我已经在我的 PHP 服务器上安装了 Net_Geo pear 包。
这是我正在使用的代码,
获取记录($ip);// 输出 echo "Single IP 结果:"; 回声“
"; 打印_r($结果); 回声“"; // 多个 IP 的示例数组 $arr_ips = array ( gethostbyname("www.google.com"), gethostbyname("www.heise.de"), gethostbyname("www.college.ch") ); //从 net_geo 获取信息数组 $results = $net_geo->getRecord($arr_ips); // 输出 echo "Multiple IP results:
"; echo "
"; 打印_r($结果); 回声“"; ?>
但是这段代码没有显示任何结果。我认为这段代码根本不起作用。
这是 Net_Geo 对象
Net_Geo 对象 ( [cache_path] => /tmp/ [cache_ttl] => 30 [default_timeout] => 60 [default_caida_server] => http://netgeo.caida.org/perl/netgeo.cgi [default_hostip_server] => http: //api.hostip.info/ [localizer_data] => ./demo.csv [service] => [cache_prefix] => netgeo [useragent] => PHP/NetGeo [useragent_version] => 1.0 [array_limit] => 100 [cache] => Cache_Function Object ( [ expires] => 2592000 [caching] => 1 [gc_time] => 1 [gc_probability] => 1 [gc_maxlifetime] => 86400 [container] => Cache_Container_file Object ([fileLocking] => [cache_dir] => /tmp/ [文件名前缀] => netgeo [条目] => 数组 ( )
[total_size] => 0
[max_userdata_linelength] => 257
[preload] => 1
[id] =>
[group] =>
[expires] => 0
[cachedata] =>
[userdata] =>
[unknown] => 1
[encoding_mode] => base64
[highwater] => 2048000
[lowwater] => 1536000
[allowed_options] => Array
(
[0] => encoding_mode
[1] => highwater
[2] => lowwater
)
[group_dirs] => Array
(
)
)
[_debug] =>
[_default_error_mode] =>
[_default_error_options] =>
[_default_error_handler] =>
[_error_class] => PEAR_Error
[_expected_errors] => Array
(
)
)
[netgeo_global] => netgeo_global
[useragent_string] =>
[default_server] =>
[last_target] =>
[applicationName] =>
[alternateServerUrl] =>
)
谢谢