Still worrying about the WeChat domain name being blocked? Here the WeChat domain name detection and anti-blocking solution eliminates doubts

Posted Jun 16, 20204 min read

For companies that do all kinds of networks, the most annoying thing is that the domain name is blocked. So many promotional messages are sent every day. If the domain name is blocked, wouldn t it be a loss, even many will be blocked several times a day

Let's talk about the first step, is the domain name detection
The principle of domain name detection is to continuously send detection information to the domain name through the software, and constantly receive feedback. If it is blocked, you can get notice immediately, so that the blocked domain name can be replaced, so that the promotion can be relayed and continue to be promoted. If you are not notified and replaced in a timely manner after being sealed, the company's other promotion will be useless, resulting in losses.

What are the requirements for domain name detection software
In fact, the WeChat domain name detection interface can be developed by yourself or purchased from the corresponding service platform.
However, there are two requirements for domain name detection software that must be noted:

The first is stability. The continuous detection cannot be stopped halfway. As mentioned above, if the WeChat domain name is sealed and replaced without timely notification, the company's promotion will be useless, resulting in losses.
The second one is the detection frequency, that is how often, there are 2 seconds/time, 1 second/time, unlimited frequency, etc.(Note:2S/time means that the interface is requested once every 2 seconds), this mainly depends on the day The amount of detection to choose.
There are many detection methods, such as packet capture, image recognition, etc., depending on the level of each technology company. The current advanced technology is protocol detection:

Share a piece of code for everyone:
`namespace ConsoleAPI{
class Program{
static void Main(string[]args){
string url = " http://api.monkeyapi.com ";
var parameters = new Dictionary<string, string>();

    parameters.Add("appkey", "appkey"); //APPKEY you applied for
    parameters.Add("url", "www.monkeyapi.com"); //Website to be queried

    string result = sendPost(url, parameters, "post");

    //The download address of the JsonObject class in the code:http://download.csdn.net/download/gcm3206021155665/7458439
    JsonObject newObj = new JsonObject(result);
    String errorCode = newObj["error_code"].Value;

    if(errorCode == "0")
    {
        Debug.WriteLine("Success");
        Debug.WriteLine(newObj);
    }
    else
    {
        //Debug.WriteLine("Request exception");
        Debug.WriteLine(newObj["error_code"].Value+":"+newObj["reason"].Value);
    }
}

///<summary>
///Http(GET/POST)
///</summary>
///<param name="url">Request URL</param>
///<param name="parameters">request parameters</param>
///<param name="method">Request method</param>
///<returns>response content</returns>
static string sendPost(string url, IDictionary<string, string> parameters, string method){
    if(method.ToLower() == "post")
        {
            HttpWebRequest req = null;
            HttpWebResponse rsp = null;
            System.IO.Stream reqStream = null;
        try
        {
            req =(HttpWebRequest)WebRequest.Create(url);
            req.Method = method;
            req.KeepAlive = false;
            req.ProtocolVersion = HttpVersion.Version10;
            req.Timeout = 60000;
            req.ContentType = "application/x-www-form-urlencoded;charset=utf-8";
            byte[]postData = Encoding.UTF8.GetBytes(BuildQuery(parameters, "utf8"));
            reqStream = req.GetRequestStream();
            reqStream.Write(postData, 0, postData.Length);
            rsp =(HttpWebResponse)req.GetResponse();
            Encoding encoding = Encoding.GetEncoding(rsp.CharacterSet);
            return GetResponseAsString(rsp, encoding);
        }
            catch(Exception ex)
        {
            return ex.Message;
        }
        finally
        {
            if(reqStream != null) reqStream.Close();
            if(rsp != null) rsp.Close();
        }
    }
    else
    {
        //Create request
        HttpWebRequest request =(HttpWebRequest)WebRequest.Create(url + "?" + BuildQuery(parameters, "utf8"));

        //GET request
        request.Method = "GET";
        request.ReadWriteTimeout = 5000;
        request.ContentType = "text/html;charset=UTF-8";
        HttpWebResponse response =(HttpWebResponse)request.GetResponse();
        Stream myResponseStream = response.GetResponseStream();
        StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));

        //Return content
        string retString = myStreamReader.ReadToEnd();
        return retString;
    }
}

///<summary>
///Assemble ordinary text request parameters.
///</summary>
///<param name="parameters">Key-Value request parameter dictionary</param>
///<returns>URL encoded request data</returns>
static string BuildQuery(IDictionary<string, string> parameters, string encode){
    StringBuilder postData = new StringBuilder();
    bool hasParam = false;
    IEnumerator<KeyValuePair<string, string>> dem = parameters.GetEnumerator();
    while(dem.MoveNext())
    {
        string name = dem.Current.Key;
        string value = dem.Current.Value;
        //Ignore parameters whose parameter name or parameter value is empty
        if(!string.IsNullOrEmpty(name))//&& !string.IsNullOrEmpty(value)
        {
            if(hasParam)
            {
                postData.Append("&");
            }
            postData.Append(name);
            postData.Append("=");
            if(encode == "gb2312")
            {
                postData.Append(HttpUtility.UrlEncode(value, Encoding.GetEncoding("gb2312")));
            }
                else if(encode == "utf8")
            {
                postData.Append(HttpUtility.UrlEncode(value, Encoding.UTF8));
            }
            else
            {
                postData.Append(value);
            }
            hasParam = true;
        }
    }
    return postData.ToString();
}

///<summary>
///Convert the response stream to text.
///</summary>
///<param name="rsp">response stream object</param>
///<param name="encoding">encoding method</param>
///<returns>response text</returns>
static string GetResponseAsString(HttpWebResponse rsp, Encoding encoding){
    System.IO.Stream stream = null;
    StreamReader reader = null;
    try
    {
        //Read the HTTP response as a character stream
        stream = rsp.GetResponseStream();
        reader = new StreamReader(stream, encoding);
        return reader.ReadToEnd();
    }
    finally
    {
        //release resources
        if(reader != null) reader.Close();
        if(stream != null) stream.Close();
        if(rsp != null) rsp.Close();
    }
}<--If you want to know, you can add a deduction 3396103977 or v mkapi005-->

}
`