ITPub博客

首页 > 应用开发 > IT综合 > 分享一个可以查询ICP域名备案信息网站API接口

分享一个可以查询ICP域名备案信息网站API接口

原创 IT综合 作者:00oo00oO0o 时间:2020-02-05 14:53:42 0 删除 编辑

很多地方填信息都需要填上域名的备案号,每次使用都得: 

搜索备案查询-点开链接-输入域名-(有些站点还需要输入验证码)-获取到备案号-复制出来。 

这样的方法太过于繁琐,我就尝试搜索了一下域名备案API接口,找到了一些可用的,不过大多都需要注册登录或者付费,所以找到一个免费的接口,改改发布出来。 废话不多,

接口地址:

http://www.beiancx.cn/icpcx?url_long=http://www.baidu.cn/

接口来源:

http://www.beiancx.cn


调用代码

HP调用演示:

$url = 'http://;
$api_url = 'http://www.beiancx.cn/icpcx?url_long=http://www.baidu.cn/;
$short_url = file_get_contents($api_url);
echo $short_url;

JAVA调用演示:

public static void main(String path[]) throws Exception {
URL u = new URL("http://www.beiancx.cn/icpcx?url_long=http://www.baidu.cn/");
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 = 'http://www.beiancx.cn'
path = '/icpcx?url_long'
method = 'GET'
querys = 'url_long=http%3A%2F%2F
bodys = {}
url = host + path + '?' + querys
request = urllib2.Request(url)
response = urllib2.urlopen(request)
content = response.read()
if (content):
print(content)




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69960425/viewspace-2674551/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2020-02-05

  • 博文量
    1
  • 访问量
    28