接口地址:https://api.dzzui.com/api/ipcx
请求方式:GET/POST
返回格式:JSON

请求参数说明:

名称 必填 类型 说明
 ipstring需要查询的IP

返回参数说明:

名称 类型 说明
 codestring状态码
 msgstring提示信息
 countrystring国家
 regionstring省份
 citystring地区
 ispstring网络

返回示例:

{"code":200,"msg":"成功","country":"XX","region":"XX","city":"内网IP","isp":"内网IP"}

状态码参照:

  状态码 说明
  200成功
  204参数不能为空
  404查询失败

PHP演示:

<?php

header("Content-Type:text/html;charset=UTF-8");

date_default_timezone_set("PRC");

$result = file_get_contents("https://api.dzzui.com/api/ipcx.php?ip=0.0.0.0");

$arr=json_decode($result,true);

if ($arr["code"] == 200) {

    echo "国家:".$arr["country"]."<br>省份:".$arr["region"]."<br>地区:".$arr["city"]."<br>网络:".$arr["isp"];

} else {

    echo $arr["msg"];

}

?>