分享一个域名ICP备案检测接口代码

有些公司某个业务需要查询接入客户的域名备案状态和备案号,使用时都得:搜索备案查询-输入域名-输入验证码-获取备案号-复制。操作过程麻烦,尝试搜索了一下域名ICP备案api接口,分享给大家!

接口地址:http://api.new.urlzt.com/api/icp

接口来源:https://www.urlzt.com/

调用代码

HP调用示例:

url = 'https://www.urlzt.com';
api_url = 'http://api.new.urlzt.com/api/icp?token=Token(Token值后台自动生成获取)&url=www.urlzt.com;
short_url = file_get_contents($api_url);
echo $short_url;

Java调用示例:

public static void main(String path[]) throws Exception {
     
URL u = new URL("http://api.new.urlzt.com/api/icp?token=Token(Token值后台自动生成获取)&url=www.urlzt.com");
InputStream in = u.openStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
     
byte buf[] = new byte[1024];
int read = 0;
while ((read = in .read(buf)) > 0) {
     
out.write(buf, 0, read);
}
} finally {
     
if ( in != null) {
     
in .close();
}
}
byte b[] = out.toByteArray();
System.out.println(new String(b, "utf-8"));
}

Python代码示例:

import urllib, urllib2, sys
host = 'https://www.urlzt.com'
path = '/icpcx?url_long'
method = 'GET'
querys = 'http://api.new.urlzt.com/api/icp?token=Token(Token值后台自动生成获取)&url=www.urlzt.com'
bodys = {
     }
url = host + path + '?' + querys
request = urllib2.Request(url)
response = urllib2.urlopen(request)
content = response.read()
if (content):
print(content)

Json返回示例:

 {
     
                "code":200,
                "msg":"已备案",
                "data":[
                  {
     
                      "homeUrl":"www.urlzt.com",
                      "natureName":"企业",
                      "serviceLicence":"皖ICP备19022901号-2",
                      "serviceName":"域名防红",
                      "unitName":"合肥极强臻科技有限公司",
                      "updateRecordTime":"2020-10-14 16:20:18"
                  }
                ]
            }

你可能感兴趣的:(域名检测,python,java,http)