查询ICP备案接口源码

可以查询域名的备案情况,采用GET提交

[title]接口演示[/title]

https://api.ayfre.com/icp.php?url=qq.com

[title]请求方式[/title]

GET请求

[title]返回格式[/title]

json

[title]参数[/title]

url=要查询的域名

[title]返回数据[/title]

{“code”:”200″,”主办单位名称”:”深圳市腾讯计算机系统有限公司”,”主办单位性质”:”企业”,”网站备案/许可证号”:”粤B2-20090059-5″,”网站名称”:”腾讯网”,”网站首页网址”:”www.qq.com”,”审核时间”:”2019/4/12 0:00:00″}

 

源码:

[hide reply_to_this=”true”]

<?php
$res = @$_GET[‘dm’];
if(strstr($res,”.”))
{
$json = file_get_contents(‘http://icp.chinaz.com/’.$res); //调用的站长工具
function GetBetween($content,$start,$end){
$r = explode($start, $content);
if (isset($r[1])){
$r = explode($end, $r[1]);
return $r[0];
}
return ”;
}
// 获取主办单位名称
$b =’主办单位名称</span><p>’;
$c ='<‘;
$name = GetBetween($json,$b,$c);
// 获取性质
$b =’主办单位性质</span><p><strong class=”fl fwnone”>’;
$c ='<‘;
$nature = GetBetween($json,$b,$c);
// 获取备案号
$b =’网站备案/许可证号</span><p><font>’;
$c ='<‘;
$icp = GetBetween($json,$b,$c);
// 获取网站名称
$b =’网站名称</span><p>’;
$c ='<‘;
$sitename = GetBetween($json,$b,$c);
// 获取网站首页地址
$b =’网站首页网址</span><p class=”Wzno”>’;
$c ='<‘;
$index = GetBetween($json,$b,$c);
if(strstr($index,”.”))
{ }else{
echo ‘{“code”:201,”msg”:”未有此域名ICP备案记录!”}’;
exit();
}
// 获取审核时间
$b =’审核时间</span><p>’;
$c ='<‘;
$time = GetBetween($json,$b,$c);
echo ‘
{“code”:”200″,”主办单位名称”:”‘. $name.'”,”主办单位性质”:”‘. $nature.'”,”网站备案/许可证号”:”‘. $icp.'”,”网站名称”:”‘. $sitename.'”,”网站首页网址”:”‘. $index.'”,”审核时间”:”‘. $time.'”}
‘;
}else{
echo ‘{“code”:202,”msg”:”域名不能为空!”}’;
// echo “内容不为空”;
// return false;
exit();
}
?>

[/hide]

温馨提示: 本文最后更新于2019-05-15,至今已有1806天,某些文章具有时效性,若有错误或已失效,请在下方留言
© 版权声明
THE END
喜欢就支持一下吧❀
点赞0投币 分享
评论 共1条

    请登录后查看评论内容