| 接口地址:http://zhouxunwang.cn/data/?id=21 | 
|---|
| 返回格式:json | 
| 请求方式:get | 
| 请求示例:http://zhouxunwang.cn/data/?id=21&key=R5RTF4G5F5H&ip=222.133.15.49 | 
| 名称 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| key | string | 必填 | 平台KEY 扫码关注公众号 | 
| ip | string | 必填 | 要查询的ip地址 | 
| 名称 | 类型 | 说明 | 
|---|---|---|
| result | string | 返回结果集 | 
| area | string | 地区 | 
| location | string | 位置 | 
{
	"code": 0,
	"data": {
		"ip": "222.133.15.46",
		"country": "中国",
		"area": "",
		"region": "山东",
		"city": "德州",
		"county": "XX",
		"isp": "联通",
		"country_id": "CN",
		"area_id": "",
		"region_id": "370000",
		"city_id": "371400",
		"county_id": "xx",
		"isp_id": "100026"
	}
}| 错误码 | 说明 | 
|---|---|
| 00001 | 参数有空 | 
| 00002 | KEY错误 | 
| 00003 | 未办理过该业务 | 
| 00004 | 条数不够 | 
| 00005 | 已到期 | 
| 00006 | 今天条数已用光 | 
| 00007 | 您的帐号不存在 | 
| 10001 | 错误的请求KEY | 
| 10002 | 该KEY无请求权限 | 
| 10003 | KEY过期 | 
| 10004 | 错误的OPENID | 
| 10005 | 应用未审核超时,请提交认证 | 
| 10007 | 未知的请求源 | 
| 10008 | 被禁止的IP | 
| 10009 | 被禁止的KEY | 
| 10011 | 当前IP请求超过限制 | 
| 10012 | 请求超过次数限制 | 
| 10013 | 测试KEY超过请求限制 | 
| 10014 | 系统内部异常 | 
| 10020 | 接口维护 | 
| 10021 | 接口停用 | 
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2020/09/05 16:46
 */
class freeApi
{
    private $apiUrl;
    public function __construct()
    {
        $this->apiUrl = 'http://zhouxunwang.cn/data/?id=21&key=R5RTF4G5F5H&ip=222.133.15.49';
    }
    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}package main
import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)
const (
	APIURL   = "http://zhouxunwang.cn/data/?id=21&key=R5RTF4G5F5H&ip=222.133.15.49"
)
func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}