身份证查询
ROLL 官方文档
根据身份证号码查询身份证归属地信息
基本说明:
接口地址:https://www.mxnzp.com/api/idcard/search
返回格式:json
请求方式:get
请求示例:https://www.mxnzp.com/api/idcard/search?idcard=your&app_secret=your&app_id=your
请求参数说明:
名称 类型 必填 说明
app_secret string 必填 app_secret 扫码关注公众号
app_id string 必填 app_id 扫码关注公众号
idcard string 必填 身份证号码
返回参数说明:
名称 类型 说明
idCardNum string 身份证号码
address string 身份证所属归属地
birthday string 生日
sex string 性别
JSON返回示例:
{
	"code": 1,
	"msg": "数据返回成功!",
	"data": {
		"idCardNum": "330326198903081211",
		"address": "浙江省温州市平阳县",
		"birthday": "1989年03月08日",
		"sex": "男"
	}
}
服务级错误码参照
错误码 说明
0 app_id或者app_secret不合法
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2022/11/03 09:56
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://www.mxnzp.com/api/idcard/search?idcard=your&app_secret=your&app_id=your';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "https://www.mxnzp.com/api/idcard/search?idcard=your&app_secret=your&app_id=your"
)

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))
}