PHP微信域名拦截检测API接口代码实现
```php <?php function checkDomain($url) { $api = 'https://api.weixin.qq.com/wxa/getdomaininfo?access_token=' . getAccessToken(); $data = ['action' => 'checkUrl', 'url' => $url]; $response = json_decode(file_get_contents($api, false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode($data), ], ]))); if ($response->errcode == 0) { if ($response->result->status == 1) { return true; } else { return false; } } else { return false;
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'=>'域名正常');}echojson_encode($value,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);?>相关专题