接口路径(新):http://api.okayapi.com/api/Ext/IP/GetInfo
接口路径(旧):http://api.okayapi.com/?s=Ext.IP.GetInfo
接口描述: 根据IP地址获取归属信息,定位用户所在城市
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
ip | String | Optaion | IP地址,不传时自动取客户端IP地址,示例:192.168.0.1 |
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口
$rs = OkayApiClient::request('Ext.IP.GetInfo',3000);
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[data] => Array
(
[ip] => 你的ip
[country] => 中国
[region] => **
[city] => **
[isp] => 移动
)
[err_msg] =>
)
[msg] => 小白开放接口:Ext.IP.GetInfo
)
*/
KEY | Type | Description |
---|---|---|
data.ip | String | 当前IP地址 |
data.country | String | Ip地址的所在国家 |
data.region | String | Ip地址的所在地区 |
data.city | String | Ip地址的所在城市 |
data.isp | String | Ip地址的所在服务商 |
Power by OkayAPI.com Contact us (WA: okayapi OR Email: chanzonghuang@gmail.com).
Timezone: America/New_York May/09/2025 06:28:54