实现也是很简单,通过抓取腾讯的域名状态判断接口,从而判断出域名是否报毒。
代码如下:
<?php header("content-type:application/json; charset=utf-8"); function curl($durl){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $durl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ; curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) ; $data = curl_exec($ch); curl_close($ch); return $data; } $urls=$_REQUEST['url']; $url=str_replace("http://","",$urls); $url=str_replace("https://","",$url); $url=str_replace("www.","",$url); $axs=curl('http://cgi.connect.qq.com/qqconnectopen/get_urlinfoForQQ?xmlout=1&url=www.'.$url.'&md5sum&version=5587'); $urlpd=strpos($axs, "<result type=\"513\">") !== false ? '已报毒' : '未报毒'; $result .=json_encode(array('url'=>$urlx,'result'=>$urlpd),JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); if ($result == '') { exit ("{ \"text\": \"检测失败!\" }"); }else { exit ($result); } ?>
发表评论