获取IP信息归属地详细版


接口地址

https://api.vvhan.com/api/getIpInfo

返回格式

JSON

请求方式:

GET

请求示例(无指定IP)

https://api.vvhan.com/api/getIpInfo

请求示例(指定IP)

https://api.vvhan.com/api/getIpInfo?ip=58.154.0.0

参数说明

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

返回数据

{"success":true,"ip":"58.154.0.0","info":{"postcode":"110117","lsp":"沈阳建筑大学","lat":"41.712509","lng":"123.443611","radius":"24.7679"},"location":{"continent":"亚洲","country":"中国","prov":"辽宁省","city":"沈阳市","district":"浑南区","address":"无数据"}}

调用实例

自行调用

示例代码

<?php
header("Content-Type:text/json;charset=UTF-8"); date_default_timezone_set("PRC"); $ip = $_GET["ip"]; $url = "https://api.vvhan.com/api/getIpInfo?ip=".$ip; $data=file_get_contents($url); echo $data;
?>