如何快速知道域名是否被微信拦截停止访问?
分享一个域名是否被微信拦截的检测接口平时用微信打开一些公司的网址,结果发现被停止访问,对于这样的情况,对我们公司而言真的还是有很大的影响的,当时就各种想办法,然后就找到了下面这个微信域名检测接口,是实时检测微信域名是否被拦截的,挺不错的微信域名检测接口百度搜索godtest
[if !supportLists]1. [endif]
<?php
[if !supportLists]2. [endif]
[if !supportLists]3. [endif]
//您的 API Token,在用户中心可查询到
[if !supportLists]4. [endif]
[if !supportLists]5. [endif]
$apiToken = "********************************";
[if !supportLists]6. [endif]
[if !supportLists]7. [endif]
//需要检测的地址或域名
[if !supportLists]8. [endif]
[if !supportLists]9. [endif]
$reqUrl = "www.qq.com";
[if !supportLists]10. [endif]
[if !supportLists]11. [endif]
$url = sprintf("https://wx.godtest.cn.api/v1/wxUrlCheck?api_token=%s&req_url=%s", $apiToken, $reqUrl);
[if !supportLists]12. [endif]
[if !supportLists]13. [endif]
$ch = curl_init($url);
[if !supportLists]14. [endif]
[if !supportLists]15. [endif]
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
[if !supportLists]16. [endif]
[if !supportLists]17. [endif]
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
[if !supportLists]18. [endif]
[if !supportLists]19. [endif]
$responseBody = curl_exec($ch);
[if !supportLists]20. [endif]
[if !supportLists]21. [endif]
$responseArr = json_decode($responseBody, true);
[if !supportLists]22. [endif]
[if !supportLists]23. [endif]
if (json_last_error() != JSON_ERROR_NONE) {
[if !supportLists]24. [endif]
[if !supportLists]25. [endif]
echo "JSON解析接口结果出错\n";
[if !supportLists]26. [endif]
[if !supportLists]27. [endif]
return;
[if !supportLists]28. [endif]
[if !supportLists]29. [endif]
}
[if !supportLists]30. [endif]
[if !supportLists]31. [endif]
if (isset($responseArr['code']) && $responseArr['code'] == 0) {
[if !supportLists]32. [endif]
[if !supportLists]33. [endif]
//接口正确返回
[if !supportLists]34. [endif]
[if !supportLists]35. [endif]
// $responseArr['data']['status']的取值范围:ok、blocked
[if !supportLists]36. [endif]
[if !supportLists]37. [endif]
// ok表示正常、blocked 表示被封
[if !supportLists]38. [endif]
[if !supportLists]39. [endif]
printf("测试地址(%s)的状态为:%s\n", $reqUrl, $responseArr['data']['status']);
[if !supportLists]40. [endif]
[if !supportLists]41. [endif]
} else {
[if !supportLists]42. [endif]
[if !supportLists]43. [endif]
printf("接口异常:%s\n", var_export($responseArr, true));
[if !supportLists]44. [endif]
[if !supportLists]45. [endif]
}
[if !supportLists]46. [endif]
复制代码