admin
2020-05-06 24a8d17e007545f7426c48352109aa1a9c6587ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.yeshi.fanli.util.wx;
 
import java.util.HashMap;
import java.util.Map;
 
import org.yeshi.utils.HttpUtil;
 
import net.sf.json.JSONObject;
 
/**
 * 微信域名拦截
 * @author Administrator
 *
 */
public class WXInterceptorUtil {
    
    public static final int STATUS_NORMAL=1;//正常
    
    public static final int STATUS_INTERCEPTOR=0;//被拦截
    
    public static final int STATUS_UNKNOWN_=2;//检测失败
 
    
    
    /**
     * 微信域名检测
     * @return
     */
    
    public static int getDomainStatus(String domain)
    {
        Map<String,String> params=new HashMap<>(); 
        params.put("domain",domain);
        
        Map<String,String> headers=new HashMap<>(); 
        headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
        headers.put("X-Requested-With","XMLHttpRequest");
        headers.put("Referer","http://www.yumingjiance.net/index.php?s=/weixin/index/cate/weixinjiance.html");
        
        String result=    HttpUtil.post("http://www.yumingjiance.net/index.php?s=/Index/ck_weixin", params,headers);
     JSONObject resultJson=    JSONObject.fromObject(result);
        if(resultJson.optInt("status")==1)
            return STATUS_NORMAL;
        else if(resultJson.optInt("status")==0)
            return STATUS_INTERCEPTOR;
        else
            return STATUS_UNKNOWN_;
    
        
        
    }
    
    
}