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

请求参数说明:

名称 必填 类型 说明
  IP string IP

返回参数说明:

名称 类型 说明
 codestring返回的状态码
  msg string 返回提示信息
  country string 国家
  region string 省份
  city string 地区
  isp string 网络

返回示例:

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

错误码参照:

  错误码 说明
  4 失败
  3 参数不能为空

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"] == 1) {

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

} else {

    echo $arr["msg"];

}

?>