淘宝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’,}
野草云服务器怎么样?野草云是一家成立了9年的国人主机商家,隶属于香港 LucidaCloud Limited (HongKong Registration No. 2736053 / 香港網上查冊中心)。目前,野草云主要销售香港、美国的VPS、虚拟主机及独立服务器等产品,本站也给大家分享过多次他家的优惠了,目前商家开启了优惠活动,香港/美国洛杉矶CN2+BGP云服务器,1核1G仅38元/月起!点击...
之前几个月由于CHIA挖矿导致全球固态硬盘的价格疯涨,如今硬盘挖矿基本上已死,硬盘的价格基本上恢复到常规价位,所以,pacificrack决定对全系Cloud server进行价格调整,降幅较大,“如果您是老用户,请通过续费管理或升级套餐,获取同步到最新的定价”。官方网站:https://pacificrack.com支持PayPal、支付宝等方式付款VPS特征:基于KVM虚拟,纯SSD raid...
近日CloudCone发布了七月的特价便宜优惠VPS云服务器产品,KVM虚拟架构,性价比最高的为2核心1.5G内存1Gbps带宽5TB月流量,2.89美元/月,稳定性还是非常不错的,有需要国外便宜VPS云服务器的朋友可以关注一下。CloudCone怎么样?CloudCone服务器好不好?CloudCone值不值得购买?CloudCone是一家成立于2017年的美国服务器提供商,国外实力大厂,自己开...