接入教程
GET https://ipinfo.io/json1. 无需注册直接查询当前IP:
2. 查询指定IP:https://ipinfo.io/8.8.8.8/json。
3. 返回city、region、country、org(ASN)、timezone、loc(经纬度)等字段。
4. 免费Token:每月50000次,注册后在ipinfo.io获取。
5. 更多数据(ASN详情、隐私检测)需付费套餐。
Python 查询IP信息
python
import requests
r = requests.get("https://ipinfo.io/8.8.8.8/json")
d = r.json()
print(d["city"], d["region"], d["org"])
PHP 查询IP信息
php
<?php
$d = json_decode(file_get_contents("https://ipinfo.io/8.8.8.8/json"), true);
echo $d["city"] . " " . $d["org"];
JavaScript 查询IP信息
javascript
const d = await fetch("https://ipinfo.io/8.8.8.8/json").then(r => r.json());
console.log(d.city, d.region, d.org);
常见问题
免费额度是多少?
无Token按IP每天1000次;注册免费Token后每月50000次。
需要绑定信用卡吗?
不需要。免费Token注册即可获得,无需信用卡。
Aitishiku.com