接口地址:https://cn.apihz.cn/api/ip/shouji.php |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://cn.apihz.cn/api/ip/shouji.php?id=10004093&key=freeapi&phone=13219931963 |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
id | int | 必填 | 用户中心的数字ID |
key | string | 必填 | 对应平台通讯秘钥 扫码关注公众号 |
phone | string | 必填 | 手机号 |
名称 | 类型 | 说明 |
---|---|---|
haoduan | string | 手机号段 |
shengfen | string | 省级归属地 |
chengshi | string | 市级归属地 |
fuwushang | string | 手机号服务商 |
quhao | string | 区号 |
youbian | string | 邮编 |
qhdm | string | 区划代码 |
{
"code": 200,
"haoduan": "1321993",
"shengfen": "四川",
"chengshi": "绵阳",
"fuwushang": "中国联通",
"quhao": "0816",
"qhdm": "510700",
"youbian": "621000"
}
错误码 | 说明 |
---|---|
400 | 错误信息提示 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2025/4/20 07:11
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://cn.apihz.cn/api/ip/shouji.php?id=10004093&key=freeapi&phone=13219931963';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://cn.apihz.cn/api/ip/shouji.php?id=10004093&key=freeapi&phone=13219931963"
)
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))
}