https://api-v2.cenguigui.cn/api/UserInfo/apilet.php
GET
JSON
正常启用
以下参数为接口所需调用信息
| 参数 | 是否必填 | 类型 | 说明 | 示例 |
|---|---|---|---|---|
| ip | 参数 | 否 | 无 |
https://api-v2.cenguigui.cn/api/UserInfo/apilet.php?ip=101.88.133.75
https://api-v2.cenguigui.cn/api/UserInfo/apilet.php?ip=101.88.133.75
自动获取
https://api-v2.cenguigui.cn/api/UserInfo/apilet.php
{
"code": "200",
"msg": "请求成功",
"data": [
{
"name": "嘉定区",
"geo": {
"latitude": 31.37482,
"longitude": 121.26621
},
"address": {
"addressSubregion": "上海市",
"addressRegion": "上海市",
"addressCountry": "中华人民共和国",
"countryIso": "cn",
"text": "上海市"
}
},
{
"name": "金山区",
"geo": {
"latitude": 30.74185,
"longitude": 121.34242
},
"address": {
"addressSubregion": "上海市",
"addressRegion": "上海市",
"addressCountry": "中华人民共和国",
"countryIso": "cn",
"text": "上海市"
}
},
{
"name": "奉贤区",
"geo": {
"latitude": 30.91803,
"longitude": 121.4741
},
"address": {
"addressSubregion": "上海市",
"addressRegion": "上海市",
"addressCountry": "中华人民共和国",
"countryIso": "cn",
"text": "上海市"
}
},
{
"name": "静安区",
"geo": {
"latitude": 31.22352,
"longitude": 121.45591
},
"address": {
"addressSubregion": "上海市",
"addressRegion": "上海市",
"addressCountry": "中华人民共和国",
"countryIso": "cn",
"text": "上海市"
}
},
{
"name": "青浦区",
"geo": {
"latitude": 31.14979,
"longitude": 121.12426
},
"address": {
"addressSubregion": "上海市",
"addressRegion": "上海市",
"addressCountry": "中华人民共和国",
"countryIso": "cn",
"text": "上海市"
}
}
]
}
// JavaScript调用示例
fetch("https://api-v2.cenguigui.cn/api/UserInfo/apilet.php?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-v2.cenguigui.cn/api/UserInfo/apilet.php?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-v2.cenguigui.cn/api/UserInfo/apilet.php?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-v2.cenguigui.cn/api/UserInfo/apilet.php?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-v2.cenguigui.cn/api/UserInfo/apilet.php?ip=101.88.133.75";
var response = await client.GetAsync(url);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// 响应结果将显示在这里