本功能对应的PHP SDK:https://github.com/wechaturl/wechat_url_api/blob/master/CheckIp_example.php
经过大数据分析发现,大部分云厂商会非法劫持http流量,或许比我们想象的严重,有部分大厂对劫持的内容做隐私大数据分析。
请求URL:
https://wechaturl.us/api/CheckIp.json
请求方式:
POST 或者GET(如果用GET,特殊字符串需要url编码)
参数:
参数名 | 必选 | 类型 | 说明 |
appid | 是 | int | http://www.wechaturl.us/user/index.html 去免费获取appid |
appkey | 是 | string | http://www.wechaturl.us/user/index.html 去免费获取appkey |
ip | 是 | string | ip地址,目前只支持ipV4 |
返回示例,
https://wechaturl.us/api/CheckIp.json?appid=37****15&appkey=a50d38748960******80ae1a725b7c95&ip=124.225.192.171
{"code": 1,"msg": "blocked","ip": "124.225.192.171","message": "this ip is in blacklist.search_range 是本次检索范围。详细请咨询客服","search_range": ["line","tencent","telegram","360","whatsapp","alibaba","facebook","bytedance","skype"],"show_error_url": "https://www.google.com/error"}#请将上面的信息保存到session
如果code=1,被拦截,直接给浏览器返回错误页面,如下面的例子;
code=0,不被拦截;
code>1,存在其他错误(详细查看)
2. search_range 是本次检索范围,目前已经支持主流厂商和浏览器.但是有些检索范围必须是“至尊会员+“,才能使用”。其中bytedance是今日头条和抖音+tiktok.详细请咨询客服
php:new:: https://github.com/wechaturl/wechat_url_api/blob/master/CheckIp_example.php<?phpif(is_numeric($CheckIpResult['code']) and $CheckIpResult['code']>1){exit($CheckIpResult['message']);}else if($CheckIpResult['code']==1){//here,show error page//http_response_code(404);//exit('page no found!');if(isset($CheckIpResult['show_error_url'])){exit(file_get_contents($CheckIpResult['show_error_url']));//当然,你可以自己写个网址}else{exit('page no found!');}}//下面就是你的代码//echo '这里写你的代码吧';?><?php//如果你的是静态单页面网站或者vue单页面,如./default.html,那使用下面方法//echo file_get_contents('./default.html')?>