Application scenarios of wechat domain name detection API:

Because wechat is strict about the external link content, it may be judged to be in violation of the content specification accidentally, or be maliciously reported and complained by peers.



So at this time, it is necessary to use the wechat domain name detection interface, real-time detection of the status of the domain name, real-time query whether the domain name is blocked by wechat, so as to prevent it from happening and not affect the promotion. The following shared wechat domain name interception detection

Directions for use

Interface address:

http://api.monkeyapi.com


Request method:

Return format:

Example request:

api.monkeyapi.com?appkey=appkey&url=www.baidu.com

JSON return example

Domain name normal: {"code": 200,"msg": "Domain name normal"."data": 0} Unofficial website, please confirm whether to continue to visit: {"code": 200,"msg": "Unofficial site, please confirm whether to continue to visit"."data": 1} Domain name blocked: {"code": 200,"msg": "Domain name blocked"."data": 2} If you want to browse, please long press the url copy and use the browser to open: {"code": 200,"msg": "If you need to browse, please long press the url to copy and open it with your browser."."data": 3Copy the code

PHP

Code share

$url = "http://api.monkeyapi.com";
$params = array(
'appkey'= >'appkey',// The APPKEY you applied for'url'= >'www.monkeyapi.com',// The site to be queried);$paramstring = http_build_query($params);
$content = Curl($url.$paramstring);
$result = json_decode($content.true);
if($result) {
    var_dump($result);
}else{// Request exception} /** * The content returned by the request interface * @param string$url[Requested URL] * @param string$params* @param int$ipost[Whether POST is used] * @return    string
*/
function Curl($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;
}Copy the code