Whois 域名
ALAPI 官方文档
获取域名的的whois信息
基本说明:
接口地址:https://v1.alapi.cn/api/whois
返回格式:json
请求方式:get/post
请求示例:https://v1.alapi.cn/api/whois?domain=www.free-api.com
请求参数说明:
名称 类型 必填 说明
domain string 必填 要查询的域名
返回参数说明:
名称 类型 说明
- - -
JSON返回示例:
{
	"code": 200,
	"msg": "success",
	"data": {
		"is_reg": true,
		"domain": "FREE-API.COM",
		"suffix": "com",
		"whois_server": "grs-whois.hichina.com",
		"creation_date": "2019-04-12T01:43:24Z",
		"expiration_date": "2022-04-12T01:43:24Z",
		"registrar": "Alibaba Cloud Computing (Beijing) Co., Ltd.",
		"registrant_email": "DomainAbuse@service.aliyun.com",
		"registrant_phone": "+86.95187",
		"nomain_status": [
			"正常(ok)"
		],
		"name_server": [
			"DNS25.HICHINA.COM",
			"DNS26.HICHINA.COM"
		],
		"dnssec": "unsigned"
	},
	"Author": {
		"name": "Alone88",
		"desc": "由Alone88提供的免费API 服务,官方文档:www.alapi.cn"
	}
}
服务级错误码参照
错误码 说明
500 处理异常
完整教学代码示例
<?php

/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2020/02/01 00:16
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://v1.alapi.cn/api/new/wbtop?domain=www.free-api.com';
    }

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

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

const (
	APIURL   = "https://v1.alapi.cn/api/whois"
)

func main() {
	queryUrl := fmt.Sprintf("%s?domain=www.free-api.com",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))
}