微信域名检测API接口是腾讯对外公布的微信域名状态查询接口,可实时查询域名在微信中的状态,如果状态异常则返回结果提示“域名被封”,如果未有异常则返回结果提示“域名正常”。
域名有如下几种状态:
-
域名能正常访问(未被微信拦截)
-
域名被微信拦截
-
非微信官方网页,继续访问将转换成手机预览模式(在公众号后台把域名添加到业务域名一般能解决这个问题)
-
据用户投诉及腾讯安全网址安全中心检测,该网页包含恶意欺诈内容,为维护绿色上网环境,已停止访问
-
网页包含诱导分享、关注等诱导行为内容,被多人投诉,为维护绿色上网环境,已停止访问
源码
$url = “http://api.monkeyapi.com”;
$params = array(
‘appkey’ =>‘appkey’,//您申请的APPKEY
‘url’ =>‘www.monkeyapi.com’,//需要查询的网站
);
paramstring=httpbuildquery(paramstring = http_build_query(paramstring=httpbuildquery(params);
content=Curl(content = Curl(content=Curl(url, $paramstring);
result=jsondecode(result = json_decode(result=jsondecode(content, true);
if(KaTeX parse error: Expected '}', got 'EOF' at end of input: …{
var_dump(result);
}else {
//请求异常
}
// 想要详细了解可以+V mkapi002
/**
* 请求接口返回内容
* @param string $url [请求的URL地址]
* @param string $params [请求的参数]
* @param int ipost[是否采用POST形式]∗@returnstring∗/functionCurl(ipost [是否采用POST形式]
* @return string
*/
function Curl(ipost[是否采用POST形式]∗@returnstring∗/functionCurl(url, $params = false, $ispost = 0)
{
$httpInfo = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if ($ispost) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, $url);
}else {
if ($params) {
curl_setopt($ch, CURLOPT_URL, $url.'?'.$params);
} else {
curl_setopt($ch, CURLOPT_URL, $url);
}
}
$response = curl_exec($ch);
if ($response === FALSE) {
//echo "cURL Error: " . curl_error($ch);
return false;
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$httpInfo = array_merge($httpInfo, curl_getinfo($ch));
curl_close($ch);
return $response;
}

2837

被折叠的 条评论
为什么被折叠?



