ICP备案信息查询 PHP 源代码

优秀源码 无标签
0 907
WIZ
WIZ 自成一派 2023-01-16 18:07:37
Lv:38级
调用方法 icp.php?d=www.gov.cn
<?php
error_reporting(0);
header("Content-type:application/json; charset=UTF-8");
header('Access-Control-Allow-Origin:*');
$domain = htmlspecialchars($_GET['d'],ENT_QUOTES);
$code = 500;
if ($domain) {
    $timeStamp = time();
    $authKey = md5("testtest" . $timeStamp);
    $token = json_decode(post("auth", "authKey=$authKey&timeStamp=$timeStamp", "", "application/x-www-form-urlencoded;"));
    $token = $token->params->bussiness;
    $query = json_decode(post('icpAbbreviateInfo/queryByCondition',"{'unitName': '$domain'}",$token,'application/json;'));
    $msg = $query->msg;
    $query = $query->params->list[0];
    if ($query) {
        $code = 200;
        $domain = $query->domain;
        $data = array(
            'serviceLicence' => $query->serviceLicence,
            'unitName'       => $query->unitName,
            'natureName'     => $query->natureName,
            'updateRecordTime' => $query->updateRecordTime,
        );
    }
}

$json = array(
    'code'  => $code,
    'domain'=> $domain,
    'data'  => $data,
    'msg'   => $msg
);
foreach ($json as $key => $val) {//清除null
    if (empty($val)) {
        unset($json[$key]);
    }
}
print_r(json_encode($json,128|256));

function post($url,$data,$token,$content){
    $miit = 'https://beian.miit.gov.cn/';
    $headers = array(
        "Content-Type: {$content}charset=UTF-8",
        "Origin: $miit",
        "Referer: $miit",
        "token: $token",
        "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36",
    );
    $options = array(
        'http' => array(
            'header'  => implode("\r\n", $headers),
            'method'  => 'POST',
            'content' => $data,
        ),
    );
    $contexts  = stream_context_create($options);
    $result = file_get_contents("https://hlwicpfwc.miit.gov.cn/icpproject_query/api/$url", false, $contexts);
    return $result;
}

 ?>



#0000FF
楼主签名:DNSWIZ 站长故事
回帖
回复列表

    遵守各国法律法规 严谨违规内容

    • QQ群:1140251126
    • Email:m@max.ooo
    • 本站可以自由发布正规网站外链
    • 本站域名皆为闲置域名可出售
    本站热帖
    01 一种访问谷歌网站的简单方法 512
    02 全网疯求滑县女网红的瓜来了 283
    03 免费一年.one 域名 268
    04 罪犯,到此一游 267
    05 多IP站群服务器选择指南 237
    06 在线钢琴源码,在学习工作之余可以在线弹钢琴 212
    07 2025年了,还剩4个域名,全面停止域名买卖。 197
    08 用网址做经营场所申请营业执照有行业和经营范围限制吗? 191
    09 一起淘:阿里官方新推的私域分销项目,早加入早吃肉! 191
    10 onlyfans真的可以打开了 176
    推荐主机