菜鸡源码,专注精品下载!
当前位置:首页 > 建站教程 > 建站知识

PHP微信域名拦截检测API接口代码实现

发布时间:2024-01-05  栏目:建站知识   浏览:   分类:php教程 域名拦截 php代码

```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);?>
相关专题
评论
建站知识
建站知识
使用技巧
调试安装
运营推广