微信域名检测 微信域名检测官方接口的调用代码分享

微信域名检测官方接口的使用方法,含PHP、Java、Python调用演示代码。微信域名检测官方接口是腾讯发布的微信域名状态查询接口,程序调用域名检测接口即可实时返回域名在微信内的生存状态,如果已被拦截返回结果提示“域名被封”,如果未被拦截则返回结果提示“域名正常”

API接口

 1、http://www.qqdwz.cn/ymjc?url_long=http://www.baidu.com 

 2、http://www.maoapi.cn/wxymjc?url_long=http://www.baidu.com 

接口说明 : 

www.baidu.com   换成 需要检测的域名链接就可以了,这里被检测的对象可以是域名,也可以是链接,或者说是带参数的链接也可以的! 注意事项: 

① 调用api接口时,只需在URL=后面填写需要压缩生成的长网址即可。

② 接口支持url参数,当url中出现 & 符号时,请用 %26 代替(或者使用url编码格式),否则参数可能会丢失。

③ 填写url时,必须要以http(s)://开头,否则可能会导致检测失败。

④不懂技术的朋友如需在线检测,请直接打开上述API接口的主域名即可!

返回说明

{"status":1,"msg":"域名正常"}
{"status":0,"msg":"域名被封"}

调用代码

PHP调用演示:

$url = 'http://www.baidu.com';
$api_url = 'http://www.maoapi.cn/wxymjc?url_long?url_long=http://www.baidu.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://www.maoapi.cn/wxymjc?url_long?url_long=http://www.baidu.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 = 'http://www.maoapi.cn'
path = '/wxymjc?url_long'
method = 'GET'
querys = 'url_long=http%3A%2F%2Fwww.baidu.com'
bodys = {}
url = host + path + '?' + querys
request = urllib2.Request(url)
response = urllib2.urlopen(request)
content = response.read()
if (content):
print(content)

猜你喜欢

转载自www.cnblogs.com/boooomdax/p/12530983.html
今日推荐