**#### php - 微信域名拦截检测接口调用示例:**
~~~
$url = urlencode('baidu.com');
$api_url = 'http://s.hescloud.cn/api/wxcheck?token=您的令牌&url=域名';
$result = json_decode(file_get_contents($api_url),true);
//输出code参数
echo $result['code'];
//输出整数:1正常;-1已拦截
echo $result['msg'];
//数据中文释义
echo $result['url'];
//输出您提交检测的域名
~~~
**#### **Java - 微信域名拦截检测接口调用示例:**
fastJson+apache httpclien版本网络请求,可根据自身需求进行源码改造!
~~~
import java.net.URLEncoder;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import com.alibaba.fastjson.JSONObject;
public class test {
public static void main(String path[]) throws Exception {
String url = URLEncoder.encode("baidu.com","UTF-8");
String apiUrl = "http://s.hescloud.cn/api/wxcheck?token=您的令牌&url="+url;
JSONObject obj = doGetStr(apiUrl);
System.out.println(obj.getIntValue("code"));
//输出整数:1正常;-1已拦截
System.out.println(obj.getString("msg"));
//数据中文释义
System.out.println(obj.getString("url"));
//输出您提交检测的域名
}
public static JSONObject doGetStr(String url) throws Exception{
DefaultHttpClient client = new DefaultHttpClient();//获取DefaultHttpClient请求
HttpGet httpGet = new HttpGet(url);//HttpGet将使用Get方式发送请求URL
JSONObject jsonObject = null;
HttpResponse response = client.execute(httpGet);//使用HttpResponse接收client执行httpGet的结果
HttpEntity entity = response.getEntity();//从response中获取结果,类型为HttpEntity
if(entity != null){
String result = EntityUtils.toString(entity,"UTF-8");//HttpEntity转为字符串类型
jsonObject = JSONObject.parseObject(result);//字符串类型转为JSON类型
}
return jsonObject;
}
}
~~~
**#### python - 微信域名拦截检测接口调用示例:**
~~~
import urllib, urllib2, sys
host = 'http://s.hescloud.cn'
path = '/api/wxcheck'
method = ‘GET‘
querys = ‘?token=您的令牌&url=http%3A%2F%2Fbaidu.com‘
bodys ={}
url = host + path + ‘?‘ +querys
request =urllib2.Request(url)
response =urllib2.urlopen(request)
content =response.read()
if(content):
print(content)
~~~