淘宝淘宝ip地址查询接口

查询ip地址  时间:2020-12-31  阅读:()

淘宝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’,}

CloudCone:$14/年KVM-512MB/10GB/3TB/洛杉矶机房

CloudCone发布了2021年的闪售活动,提供了几款年付VPS套餐,基于KVM架构,采用Intel® Xeon® Silver 4214 or Xeon® E5s CPU及SSD硬盘组RAID10,最低每年14.02美元起,支持PayPal或者支付宝付款。这是一家成立于2017年的国外VPS主机商,提供VPS和独立服务器租用,数据中心为美国洛杉矶MC机房。下面列出几款年付套餐配置信息。CPU:...

HostKvm($4.25/月),俄罗斯CN2带宽大升级,俄罗斯/香港高防限量5折优惠进行中

HostKvm是一家成立于2013年的国外VPS服务商,产品基于KVM架构,数据中心包括日本、新加坡、韩国、美国、俄罗斯、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。本月,商家旗下俄罗斯、新加坡、美国、香港等节点带宽进行了大幅度升级,俄罗斯机房国内电信/联通直连,CN2线路,150Mbps(原来30Mbps)带宽起,目前俄罗斯和香港高防节点5折骨折码继续优惠中...

Digital-vm80美元,1-10Gbps带宽日本/新加坡独立服务器

Digital-vm是一家成立于2019年的国外主机商,商家提供VPS和独立服务器租用业务,其中VPS基于KVM架构,提供1-10Gbps带宽,数据中心可选包括美国洛杉矶、日本、新加坡、挪威、西班牙、丹麦、荷兰、英国等8个地区机房;除了VPS主机外,商家还提供日本、新加坡独立服务器,同样可选1-10Gbps带宽,最低每月仅80美元起。下面列出两款独立服务器配置信息。配置一 $80/月CPU:E3-...

查询ip地址为你推荐
已备案域名查询如何查询网站的域名是否已经备案便宜的虚拟主机哪里有便宜的国内虚拟主机?重庆虚拟空间重庆有几个机场?国外网站空间怎么查看一个网站的空间是在国内还是在国外啊?100m虚拟主机100元虚拟主机虚拟主机软件哪种虚拟机软件好用美国虚拟主机购买美国虚拟主机如何购买美国虚拟主机购买美国虚拟主机在国内那家卖的便宜,稳定,功能全??沈阳虚拟主机沈阳盘古网络技术有限公司的介绍www二级域名www的域名是一级域名还是二级域名
VPS之家 购买域名和空间 国内永久免费云服务器 香港新世界电讯 win8升级win10正式版 空间论坛 有奖调查 100mbps 服务器监测 如何建立邮箱 美国凤凰城 国外在线代理服务器 国外网页代理 电信宽带测速软件 中国联通宽带测试 阿里云邮箱怎么注册 新网dns japanese50m咸熟 海外加速 ipower 更多