php教程

腾讯安全中心备案信息查询API接口源码

php教程 51源码 2024-04-01 人阅读

调用的腾讯安全中心平台数据,可以查询备案号、备案主体等等信息。

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

版权声明:文章搜集于网络,如有侵权请联系本站,转载请说明出处:https://www.51yma.cn/jiaocheng/php/1456.html
文章来源: