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

使用PHP检测腾讯域名拦截的API接口

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

要检测腾讯域名拦截API接口,首先需要了解腾讯域名拦截API的文档和使用方法。然后,可以使用PHP的cURL库或者file_get_contents函数来发送HTTP请求到API接口,并解析返回的数据。以下是一个简单的示例: ```php <?php // 替换为你的腾讯域名拦截API接口地址 $api_url = "https://api.example.com/check_domain?domain=example.com"; // 使用cURL发送HTTP请求 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close

PHP检测腾讯域名拦截API接口

<?phpheader('Access-Control-Allow-Origin:*');header('Content-type:application/json;charset=utf-8');error_reporting(0);!empty($_GET['url'])?$url=$_GET['url']:exit(json_encode(['code'=>-1,"msg"=>"请输入网址"],JSON_UNESCAPED_UNICODE));$json=jsonp_decode(Curl_GET("https://cgi.urlsec.qq.com/index.php?m=check&a=check&callback=jQuery11.306943167371763181_15671.3944271&url={$url}&_=".msectime()));if($json->reCode!==0){$arr=["code"=>-1,"msg"=>$json->data,];}else{$type=$json->data->results->whitetype;$urls=$json->data->results->url;if($type==1||$type==3){$arr=["code"=>1,"msg"=>"检测成功","url"=>$urls,"type"=>"正常"];}else{$arr=["code"=>1,"msg"=>"检测成功","url"=>$urls,"type"=>"拦截"];}}exit(json_encode($arr,JSON_UNESCAPED_UNICODE));/***@returnstring*CurlGET*/functionCurl_GET($url){$ch=curl_init();//Curl初始化$header=['X-FORWARDED-FOR:218.91.92.84','CLIENT-IP:218.91.92.84','Cookie:pgv_pvi=9897416704;RK=WI7w5+CMZn;ptcz=e383433090496e1f60381fd68733196426868ba1876249a6736bcc4a3eb8ec72;pgv_pvid=455855220;cid=89410138-a33a-4ea9-98f2-4436da89d67d;_tfpdata=yBRknXvS8CfrED0zD85NZfxCPzT5SW8KEY03rIziZmu9ogk9y%2B5%2FU4QrJBbfqfuVqr%2F6vw8nSWfqHR3fu2Jc0TPvszwmrMwXEdN%2B8bKKfHwNCcL%2F2%2Fbhmiu%2B%2F4IgK1DX'];curl_setopt($ch,CURLOPT_URL,$url);//设置Curl目标curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//Curl请求有返回的值curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);//设置抓取超时时间curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);//跟踪重定向curl_setopt($ch,CURLOPT_ENCODING,"");//设置编码curl_setopt($ch,CURLOPT_REFERER,$url);//伪造来源网址curl_setopt($ch,CURLOPT_HTTPHEADER,$header);//伪造IPcurl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/65.0.3325.181Safari/537.36");//伪造uacurl_setopt($ch,CURLOPT_ENCODING,'gzip');//取消gzip压缩curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);//https请求不验证证书和hostscurl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);$content=curl_exec($ch);curl_close($ch);//结束Curlreturn$content;//函数返回内容}/***返回当前毫秒*/functionmsectime(){list($msec,$sec)=explode('',microtime());return(float)sprintf('%.0f',(floatval($msec)+floatval($sec))*1000);}/***@param$jsonp*@parambool$assoc*@returnmixed*jsonp转对象*/functionjsonp_decode($jsonp,$assoc=false){$jsonp=trim($jsonp);if(isset($jsonp[0])&&$jsonp[0]!=='['&&$jsonp[0]!=='{'){$begin=strpos($jsonp,'(');if(false!==$begin){$end=strrpos($jsonp,')');if(false!==$end){$jsonp=substr($jsonp,$begin+1,$end-$begin-1);}}}returnjson_decode($jsonp,$assoc);}


相关专题

相关文章

    无相关信息
评论
建站知识
建站知识
使用技巧
调试安装
运营推广