Wechat Domain Name Interception Detection API Interface

What is Wechat Domain Name Interception Detection?
Because Wechat is strict with the content specification of external links, it may be judged as violating the content specification or being maliciously reported and complained by peers. As a result, the situation of "stop visiting this web page" occurs, which leads to the loss of a large number of traffic.

However, in order to continue to promote Wechat, it is particularly important to know whether the domain name is blocked in time.

So what is the technical principle and implementation of real-time detection of domain names being intercepted?

Wechat Domain Name Interception Detection api Interface

principle

Use Wireshark to capture the domain name interception query interface of Wechat.

Domain names have the following states:

  • Domain name can be accessed normally (not blocked by Wechat)
  • Domain name intercepted by Wechat

  • Continuous access to non-Wechat official web pages will be converted into mobile phone preview mode (adding domain names to business domain names in the background of public numbers generally solves this problem).

  • According to user complaints and Tencent security website security center detection, the page contains malicious fraud content, in order to maintain a green online environment, has stopped visiting

  • Web pages contain induced sharing, attention and other induced behavior content, which has been complained by many people. In order to maintain a green online environment, visits have been stopped.

Demo

PHP version

php
<?php
// Your API Token is available in the User Center.
$apiToken = "********************************";
// Address or domain name to be detected
$reqUrl = "Tencent Homepage";
$url = sprintf("https://wx.horocn.com/api/v1/wxUrlCheck?api_token=%s&req_url=%s", $apiToken, $reqUrl);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$responseBody = curl_exec($ch);
$responseArr = json_decode($responseBody, true);
if (json_last_error() != JSON_ERROR_NONE) {
    echo "JSON Error parsing interface result\n";
    return;
}
if (isset($responseArr['code']) && $responseArr['code'] == 0) {
    // Interface returned correctly
    // Value range of $responseArr['data']['status']: ok, blocked
    // ok means normal, blocked means blocked
    printf("Test address(%s)The state is:%s\n", $reqUrl, $responseArr['data']['status']);
} else {
    printf("Interface exception:%s\n", var_export($responseArr, true));
}

Python version

python
# -*- coding: utf-8 -*-

import json, urllib
from urllib import urlencode

def main():
    # Your API Token is available in the User Center.
    apiToken = "*********************"

    url = "https://wx.horocn.com/api/v1/wxUrlCheck"
    params = {
        "req_url" : "Tencent Homepage", #Address or domain name to be detected
        "api_token" : apiToken,

    }
    params = urlencode(params)
    f = urllib.urlopen("%s?%s" % (url, params))

    content = f.read()
    res = json.loads(content)
    if res:
        code = res["code"]
        if code == 0:
            #Successful request
            print res["result"]
        else:
            print "%s: %s" % (res["code"],res["msg"])
    else:
        print "request api error"

if __name__ == '__main__':
    main()

Tags: Mobile JSON PHP Python

Posted on Sat, 12 Oct 2019 09:27:59 -0700 by shadow1200