IP地址查询
最后更新于:2022-04-02 08:18:36
## IP地址查询
>[danger]### 免费接口,每日100次免费调用,会员可不限次数调用,购买[API会员](https://market.topthink.com/product/210)

> 根据IP地址,查询该IP所属的区域
## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086))
### 请求地址
```
GET https://api.topthink.com/ip/index
```
### 请求参数
| 名称 | 必填 | 类型 | 说明 |
| --- | --- | --- | --- |
| appCode| 是 |string| 用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) |
| ip | 是 | string | 需要查询的IP地址 |
### 返回`data`参数
| 名称 | 类型 | 说明 |
| --- | --- | --- |
| Country | string | 国家 |
| Province | string | 省份区域,部分可能为空 |
| City | string | 城市,部分可能为空 |
| Isp | string | 运营商,部分可能为空 |
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->ipIndex()
->withIp('112.3.69.244')
->request();
dump($result);
```
返回数据示例:
~~~
{
"code": 0,
"message": "成功",
"data": {
"Country": "中国",
"Province": "江苏省",
"City": "常州市",
"Isp":"移动"
},
}
~~~
';