您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

淘宝IP地址查询接口

2024/11/6 7:06:30发布24次查看
淘宝公司提供了一个很好用的ip地理信息查询接口。 在这里:http://ip.taobao.com/ taobaoipquery2这个类将极大的简化相关的信息查询。 无 ?php/* usage: * $ipinfo = taobaoipquery2::getipinfo('ipaddress'); */class taobaoipquery2{private static $_reques
淘宝公司提供了一个很好用的ip地理信息查询接口。
在这里:http://ip.taobao.com/
taobaoipquery2这个类将极大的简化相关的信息查询。 $ip)); $ch = curl_init(); $options = array( curlopt_url => sprintf('%s?%s', self::$_requesturl, $query), curlopt_returntransfer => true, curlopt_autoreferer => false, curlopt_followlocation => false, curlopt_header => false, curlopt_timeout => 3.0, ); curl_setopt_array($ch, $options); $content = curl_exec($ch); curl_close($ch); return $content; } private static function parsejson($json){ $o = json_decode ($json, true); if(false === is_null($o)){ return $o; } if (version_compare(php_version, '5.3.0', '>=')) { $errorcode = json_last_error(); if(isset(self::$_jsonparseerror[$errorcode])){ throw new exception(self::$_jsonparseerror[$errorcode], 5); } } throw new exception('json parse error', 5); } private static $_jsonparseerror = array( json_error_none=>'no error has occurred', json_error_depth=>'the maximum stack depth has been exceeded', json_error_ctrl_char=>'control character error, possibly incorrectly encoded', json_error_state_mismatch=>'invalid or malformed json', json_error_syntax=>'syntax error', json_error_utf8=>'malformed utf-8 characters, possibly incorrectly encoded', );}
$ip)); $ch = curl_init(); $options = array( curlopt_url => sprintf('%s?%s', self::$_requesturl, $query), curlopt_returntransfer => true, curlopt_autoreferer => false, curlopt_followlocation => false, curlopt_header => false, curlopt_timeout => 3.0, ); curl_setopt_array($ch, $options); $content = curl_exec($ch); curl_close($ch); return $content; } private static function parsejson($json){ $o = json_decode ($json, true); if(false === is_null($o)){ return $o; } if (version_compare(php_version, '5.3.0', '>=')) { $errorcode = json_last_error(); if(isset(self::$_jsonparseerror[$errorcode])){ throw new exception(self::$_jsonparseerror[$errorcode], 5); } } throw new exception('json parse error', 5); } private static $_jsonparseerror = array( json_error_none=>'no error has occurred', json_error_depth=>'the maximum stack depth has been exceeded', json_error_ctrl_char=>'control character error, possibly incorrectly encoded', json_error_state_mismatch=>'invalid or malformed json', json_error_syntax=>'syntax error', json_error_utf8=>'malformed utf-8 characters, possibly incorrectly encoded', );}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product