查询IP信息-网亿工作室

查询IP信息

GET /ipcha 费率:1积分/次 0.10元/次

接口说明

查询IP信息

参数说明

请求地址

接口地址: https://www.51dzsc.com/wp-json/wangyi/v1/ipcha
请求方式: GET

请求头

参数名 必填 说明
X-API-Key API密钥,用于认证请求
Content-Type 请求内容类型,固定为 application/json

请求参数

参数名 类型 必填 说明
ip string 输入IP地址

返回示例

{
    "status": "0",
    "t": "",
    "set_cache_time": "",
    "data": [
        {
            "ExtendedLocation": "",
            "OriginQuery": "传入的IP地址",
            "SchemaVer": "",
            "appinfo": "",
            "disp_type": 0,
            "fetchkey": "查询的 IP 地址",
            "location": "省 市 运营商",
            "origip": "原始 IP 地址",
            "origipquery": "原始 IP 查询",
            "resourceid": "6006",
            "role_id": 0,
            "schemaID": "",
            "shareImage": 1,
            "showLikeShare": 1,
            "showlamp": "1",
            "strategyData": {},
            "titlecont": "IP地址查询",
            "tplt": "ip"
        }
    ]
}

在线测试

示例代码

# cURL示例
curl -X GET \
    -H "X-API-Key: your_api_key" \
    -H "Content-Type: application/json" \
    
    https://www.51dzsc.com/wp-json/wangyi/v1/ipcha
# Python示例
import requests
import json

url = "https://www.51dzsc.com/wp-json/wangyi/v1/ipcha"
headers = {
    "X-API-Key": "your_api_key",
    "Content-Type": "application/json"
}
response = requests.get(url, headers=headers)

print(response.json())
# PHP示例
<?php
$url = "/ipcha";
$api_key = "your_api_key";

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "/ipcha",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: $api_key",
        "Content-Type: application/json"
    ],
]);

$response = curl_exec($curl);
$data = json_decode($response, true);

curl_close($curl);
print_r($data);
// JavaScript示例
const apiUrl = 'https://www.51dzsc.com/wp-json/wangyi/v1/ipcha';
const apiKey = 'your_api_key';

fetch(apiUrl, {
    method: 'GET',
    headers: {
        'X-API-Key': apiKey,
        'Content-Type': 'application/json'
    }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// Java示例
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class ApiExample {
    public static void main(String[] args) {
        HttpClient client = HttpClient.newHttpClient();
                HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://www.51dzsc.com/wp-json/wangyi/v1/ipcha"))
            .header("X-API-Key", "your_api_key")
            .header("Content-Type", "application/json")
            .GET()
            .build();
        
        try {
            HttpResponse response = client.send(request,
                HttpResponse.BodyHandlers.ofString());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}