淘宝IP地址查询接口
Clas s TaobaoIPQuery2{private static $_requestURL=‘http://ip.taobao.c om/s ervic e/getIpInfo.php’ ;public static function getIPInfo($ip){
$long=ip2long($ip);if($long===0){throw new Exc eption(‘IP address error’, 5);
$ip=long2 ip($long);
$IPInfo=self::queryIPInfo($ip);return self::p arseJSON($IPInfo);private static function queryIPInfo($ip){
$query=http_build_query(array(‘ip’=$ip));
$ch=curl_init();
$options=array(
CURLOPT_URL=sprintf(‘%s?%s’, s elf: :$_requestURL, $query),CURLOPT_RET URNTRANSF ER=true,
CUR LOP T_AUT OR EF ER ER=fals e,
CURLOP T_F OLLO WLO C AT I ON=fals e,
CURLOP T_HE AD ER=fals e,
CURLOP T_T IMEO UT=3.0,curl_setopt_array($ch,$options);
$c ontent=curl_exec($ch);curl_close($ch);
r eturn$c ontent;private static function parseJSON($json){
$O=json_dec ode($json, true);if(fals e===is_null($O)){r eturn$O;if(vers ion_c ompare(PHP_VERSION, ‘5.3.0’, ‘=‘)) {
$errorCode=js on_last_error();if(is s et(s elf::$_JSONPars eError[$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_DEPT H=‘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’,
J S ON_ERROR_SYNTAX=‘Syntax error’ ,
JSON_ERROR_UTF8=‘Malformed UTF-8 characters,possibly incorrectly encoded’,}
TaobaoIPQuery2.Clas s.php~2KB
?p hp
Clas s TaobaoIPQuery2{private static $_requestURL=‘http://ip.taobao.c om/s ervic e/getIpInfo.php’ ;
public static function getIPInfo($ip){
$long=ip2long($ip);if($long===0){throw new Exception(‘IP address error’, 5);
$ip=long2 ip($long);
$IPInfo=self::queryIPInfo($ip);return self::p arseJSON($IPInfo);private static function queryIPInfo($ip){
$query=http_build_query(array(‘ip’=$ip));
$ch=curl_init();
$options=array(
CURLOPT_URL=sprintf(‘%s?%s’, s elf: :$_requestURL, $query),CURLOPT_RET URNTRANSF ER=true,
CUR LOP T_AUT OR EF ER ER=fals e,
CURLOP T_F OLLO WLO C AT I ON=fals e,
CURLOP T_HE AD ER=fals e,
CURLOP T_T IMEO UT=3.0,curl_setopt_array($ch,$options);
$c ontent=curl_exec($ch);curl_close($ch);r eturn$c ontent;private static function parseJSON($json){
$O=json_dec ode($json, true);if(fals e===is_null($O)){r eturn$O;if(vers ion_c ompare(PHP_VERSION, ‘5.3.0’, ‘=‘)) {
$errorCode=js on_last_error();if(is set(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_DEPT H=‘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’,
J S ON_ERROR_SYNTAX=‘Syntax error’ ,
JSON_ERROR_UTF8=‘Malformed UTF-8 characters,possibly incorrectly encoded’,}
在之前几个月中也有陆续提到两次HostYun主机商,这个商家前身是我们可能有些网友熟悉的主机分享团队的,后来改名称的。目前这个品牌主营低价便宜VPS主机,这次有可以看到推出廉价版本的美国CN2 GIA VPS主机,月费地址15元,适合有需要入门级且需要便宜的用户。第一、廉价版美国CN2 GIA VPS主机方案我们可看到这个类型的VPS目前三网都走CN2 GIA网络,而且是原生IP。根据信息可能后续...
日前,国内知名主机服务商阿里云与国外资深服务器面板Plesk强强联合,推出 阿里云域名注册与备案、服务器ECS购买与登录使用 前言云服务器(Elastic 只需要确定cpu内存与带宽基本上就可以了,对于新手用户来说,我们在购买阿里云服务申请服务器与域名许多云服务商的云服务器配置是弹性的 三周学会小程序第三讲:服务 不过这个国外服务器有点慢,可以考虑国内的ngrokcc。 ngrokcc...
官方网站:点击访问青果云官方网站活动方案:—————————–活动规则—————————1、选购活动产品并下单(先不要支付)2、联系我司在线客服修改价格或领取赠送时间3、确认价格已按活动政策修改正确后,支付订单,到此产品开设成功4、本活动产品可以升级,升级所需费用按产品原价计算若发生退款,按资源实际使用情况折算为产品原价再退还剩余余额! 美国洛杉矶CN2_GIACPU内存系统盘流量宽带i...