php教程

php微信域名拦截检测API接口代码

精准像素 2020-08-18 人阅读

php微信域名拦截检测API接口代码

<?php
/** ----------------------------------
* wx域名检测
* Time:2020-5-15
-------------------------------------- **/
 
header('Content-type: text/json;charset=utf-8'); 
if(empty($_REQUEST['url'])){
    exit('{"code":0,"msg":"参数不正确"}');
}
$api = get_headers('http://mp.weixinbridge.com/mp/wapredirect?url='.$_REQUEST['url']);
 
if($api[1] !== 'Location: '.$_REQUEST['url'].''){
        $value = array('code'=>202,'msg'=>'域名被封');
}else{
        $value = array('code'=>200,'msg'=>'域名正常');
}
echo json_encode($value,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
?>