返回首页

【客户端信息ip】接口

浏览: 42937 最后更新: 2025-03-22 21:23:53

接口说明

【客户端信息ip】接口-本地数据库

接口基本信息

API地址

https://api.cenguigui.cn/api/UserInfo/

请求方式

GET

返回格式

JSON

接口状态

正常启用

参数说明

以下参数为接口所需调用信息

参数 是否必填 类型 说明 示例
ipstring输入IP地址

请求示例

HTTP请求

https://api.cenguigui.cn/api/UserInfo/?ip=101.88.133.75

调用示例

代码示例

接口二:https://api.cenguigui.cn/api/UserInfo/ipinfo/?ip=223.104.79.187
不加ip自动定位
返回参数如下:
{
    "code": 200,
    "msg": "请求成功-精确地ip地址查询",
    "data": {
        "ip": "223.104.79.187",
        "ip_int": 3748155323,
        "location": "中国广东深圳南山",
        "continent": "亚洲",
        "country": "中国",
        "country_code": "CN",
        "province": "广东",
        "city": "深圳",
        "district": "南山",
        "street": "",
        "isp": "移动",
        "latitude": "22.53291",
        "longitude": "113.93029",
        "area_code": "440305",
        "zip_code": "518000",
        "time_zone": "Asia/Shanghai",
        "street_history": [
            "广东深圳南山高新中一道"
        ],
        "risk": {
            "risk_score": 0,
            "risk_level": "无风险",
            "is_proxy": "否",
            "proxy_type": "",
            "risk_tag": ""
        }
    },
    "time": "2025-03-22 21:23:24",
    "tips": "笒鬼鬼api:api.cenguigui.cn"
}

返回结果

HTTP 200 OK
{
    "code": 200,
    "msg": "请求成功",
    "data": {
        "ip": "223.104.79.187",
        "country": "中国",
        "addr": "",
        "city": "",
        "district": "",
        "isp": "移动/数据上网公共出口",
        "location": "",
        "area": "移动/数据上网公共出口",
        "os": "Windows 10",
        "browser": "谷歌浏览器"
    }
}

调用示例

// JavaScript调用示例
fetch("https://api.cenguigui.cn/api/UserInfo/?ip=101.88.133.75", {
  method: "GET",
  headers: {
    "Content-Type": "application/json"
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
# Python调用示例
import requests

url = "https://api.cenguigui.cn/api/UserInfo/?ip=101.88.133.75"

response = requests.get(url)

print(response.json())
// Java调用示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class ApiExample {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
                .version(HttpClient.Version.HTTP_2)
                .connectTimeout(Duration.ofSeconds(10))
                .build();
                
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.cenguigui.cn/api/UserInfo/?ip=101.88.133.75"))
                .build();
                
        client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
                .thenApply(HttpResponse::body)
                .thenAccept(System.out::println)
                .join();
    }
}
<?php
// PHP调用示例
$url = "https://api.cenguigui.cn/api/UserInfo/?ip=101.88.133.75";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
?>
// C#调用示例
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        var url = "https://api.cenguigui.cn/api/UserInfo/?ip=101.88.133.75";
        
        var response = await client.GetAsync(url);
        
        var result = await response.Content.ReadAsStringAsync();
        Console.WriteLine(result);
    }
}