腾讯安全中心网站备案信息查询API接口源代码
调用的腾讯安全中心平台数据,可以查询备案号、备案主体等等信息。
<?php
header("Content-type:application/json; charset=UTF-8");
function getData($x){
$url = "https://cgi.urlsec.qq.com/index.php?m=check&a=check&url={$x}";
$header = [
'Referer: https://guanjia.qq.com'
];
$options = array(
'http' => array(
'header' => $header,
'method' => 'GET',
'timeout' => 5
)
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response) {
$response=substr($response, 1);
$response=json_decode(substr($response, 0, -1));
$results=$response->data->results;
$whitetype = [
'报白',
'拦截',
'正常'
];
if ($results && empty($results->whitetype) == false) {
//print_r($results);
if($results->isDomainICPOk == 1){
$json['ICPSerial']=$results->ICPSerial;
$json['Orgnization']=$results->Orgnization;
}
$qqJson = array(
'name'=> 'QQ',
'states'=> $whitetype[$results->whitetype-1],
'msg'=> $results->WordingTitle
);
$json['data'][] = $qqJson;
return $json;
}
}
}
$link = htmlspecialchars($_GET['d']);
if (!preg_match('/^(http|https):\/\//', $link)) {
$link = 'http://'.$link;
}
print_r(json_encode(getData($link),128|256));
?>返回数据
{
"ICPSerial": "粤B2-20090059-5",
"Orgnization": "深圳市腾讯计算机系统有限公司",
"data": [
{
"name": "QQ",
"states": "正常",
"msg": ""
}
]
}使用方法
保存代码,浏览器访问:域名/qqicp.php?d=qq.com
代码二:
<?php
function domain_get($domin, $timeout=30)
{
$headers = array(
"Content-Type: text/javascript;charset=UTF-8",
"Accept: */*",
"Referer:https://urlsec.qq.com/check.html"
);
$url = "https://cgi.urlsec.qq.com/index.php?m=check&a=check&callback=&url={$domin}&_=".time();
$ch = curl_init();//初始化
curl_setopt($ch, CURLOPT_URL, $url);//抓取指定网页
curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_POST, 0);//post提交方式
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36");//模拟windows用户正常访问
// curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.Rand_IP(), 'CLIENT-IP:'.Rand_IP()));//模拟用户IP
$data = curl_exec($ch);//运行curl
if($data=== false){
echo 'Curl error: ' . curl_error($ch);
}
$data = str_replace("(", "", $data);
$data = str_replace(")", "", $data);
$result = json_decode($data, true);
echo json_encode($result, JSON_UNESCAPED_UNICODE);
}
$res = domain_get("www.baidu.com");
?>whitetype为1,则网址未知
whitetype为2,则网址报毒
whitetype为3,则网址安全
whitetype为4,则网址是qq.com
-
支付宝 -
微信


