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

raksmart:年中大促,美国物理机$30/月甩卖;爆款VPS仅月付$1.99;洛杉矶/日本/中国香港多IP站群$177/月

RAKsmart怎么样?RAKsmart发布了2021年中促销,促销时间,7月1日~7月31日!,具体促销优惠整理如下:1)美国西海岸的圣何塞、洛杉矶独立物理服务器低至$30/月(续费不涨价)!2)中国香港大带宽物理机,新品热卖!!!,$269.23 美元/月,3)站群服务器、香港站群、日本站群、美国站群,低至177美元/月,4)美国圣何塞,洛杉矶10G口服务器,不限流量,惊爆价:$999.00,...

蓝竹云挂机宝25元/年,美国西雅图 1核1G 100M 20元

蓝竹云怎么样 蓝竹云好不好蓝竹云是新商家这次给我们带来的 挂机宝25元/年 美国西雅图云服务器 下面是套餐和评测,废话不说直接开干~~蓝竹云官网链接点击打开官网江西上饶挂机宝宿主机配置 2*E5 2696V2 384G 8*1500G SAS RAID10阵列支持Windows sever 2008,Windows sever 2012,Centos 7.6,Debian 10.3,Ubuntu1...

GigsGigsCloud($26/年)KVM-1GB/15G SSD/2TB/洛杉矶机房

GigsGigsCloud新上了洛杉矶机房国际版线路VPS,基于KVM架构,采用SSD硬盘,年付最低26美元起。这是一家成立于2015年的马来西亚主机商,提供VPS主机和独立服务器租用,数据中心包括美国洛杉矶、中国香港、新加坡、马来西亚和日本等。商家VPS主机基于KVM架构,所选均为国内直连或者优化线路,比如洛杉矶机房有CN2 GIA、AS9929或者高防线路等。下面列出这款年付VPS主机配置信息...

查询ip地址为你推荐
国际域名国际域名是什么?网络服务器租用网络公司租用什么服务器好(想开个网络公司,租用服务器,但是不知道哪个好?什么价位?求高手指导。)美国服务器托管美国网站服务器去哪里租?山东虚拟主机400电话哪家代理商办理得比较好apache虚拟主机linux apache虚拟主机有几种方式jsp虚拟主机java虚拟主机空间怎么选择,国内jsp虚拟主机比较稳定,现在java项目做好后需要推荐一下吧shopex虚拟主机我有一个PHP1G的虚拟主机,请问做什么站比较合适?域名交易域名交易的流程是怎么样的?花生壳域名一个花生壳使用域名的限制网络域名网络域名是指什么? 买个域名需要多少钱啊?
windows虚拟主机 中文域名 securitycenter lunarpages vps.net 百度云100as 韩国空间 外国服务器 鲜果阅读 patcha 日本bb瘦 国外代理服务器软件 域名和空间 美国在线代理服务器 免费网页申请 多线空间 根服务器 学生服务器 空间服务器 服务器硬件配置 更多