检测域名是否已被微信封掉不能访问

来源:简书 分类: 文章浏览史 发布时间:2020-06-08 23:06:39 最后更新:2020-06-08 浏览:630
转载声明:
本文为摘录自“简书”,版权归原作者所有。
温馨提示:
为了更好的体验,请点击原文链接进行浏览
摘录时间:
2020-06-08 23:06:39

微信营销中,经常出现域名被封,但是因不能及时了解情况从而浪费很多流量的情况。那么有没有办法可以实时检测域名是否已被微信封掉不能访问呢?今天我给大家分享一个专门用来解决这种情况的微信域名检测接口。

微信域名检测api接口:

http://www.xiaohejc.cn/check_api.php?url_long=http://www.baidu.com

使用说明:

将api接口地址中 "http://www.baidu.com"换成需要检测的域名,然后直接复制前往浏览器中打开即可。

PHP调用演示:

$url = 'http://www.baidu.com';

$api_url = 'http://www.xiaohejc.cn/check_api.php?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.xiaohejc.cn/check_api.php?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.xiaohejc.cn/'

path = 'check_api.php?url_long='

method = 'GET'

querys = 'url=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)

注意事项:

① 调用api接口时,只需将 “http://www.baidu.com”换成需要检测的域名或网址。

② 接口支持url参数,当url中出现 & 符号时,请用 %26 代替,否则参数可能会丢失。

③ 正式版接口请根据提示联系接口服务商进行购买开通会员版。

php技术微信