分享一个域名备案检测接口代码
发布于 4 年前 作者 gren 2236 次浏览 来自 分享

对于有些公司需要查询接入客户域名备案状态和备案号的业务,使用时都得:搜索备案查询-输入域名-输入验证码-获取备案号-复制,太繁琐,尝试搜索了一下域名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"
                  }
                ]
            }
回到顶部