淘宝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商家对旗下的大硬盘VPS云服务器进行了少量库存补货,也是悄悄推送了一批便宜VPS云服务器产品,此前较受欢迎的特价20美元/年、1核心1G内存1Gbps带宽的VPS云服务器也有少量库存,有需要美国便宜大硬盘VPS云服务器的朋友可以关注一下。CloudCone怎么样?CloudCone服务器好不好?CloudCone值不值得购买?CloudCone是一家成立于2017年的美国服务...
最近很多网站都遭受到了伪墙/假墙攻击,导致网站流量大跌,间歇性打不开网站。这是一种新型的攻击方式,攻击者利用GWF规则漏洞,使用国内服务器绑定host的方式来触发GWF的自动过滤机制,造成GWF暂时性屏蔽你的网站和服务器IP(大概15分钟左右),使你的网站在国内无法打开,如果攻击请求不断,那么你的网站就会是一个一直无法正常访问的状态。常规解决办法:1,快速备案后使用国内服务器,2,使用国内免备案服...
Pia云是一家2018的开办的国人商家,原名叫哔哔云,目前整合到了魔方云平台上,商家主要销售VPS服务,采用KVM虚拟架构 ,机房有美国洛杉矶、中国香港和深圳地区,洛杉矶为crea机房,三网回程CN2 GIA,带20G防御,常看我测评的朋友应该知道,一般带防御去程都是骨干线路,香港的线路也是CN2直连大陆,目前商家重新开业,价格非常美丽,性价比较非常高,有需要的朋友可以关注一下。活动方案...