PHP网站备案查询APIUSB代码,JSON格式回到数据,查询结果如下图,用的值班员工具查询USB二次封装。
备案查询API代码
error_reporting(0);
$url = $_GET['url'];
var_dump();
if(!isset($url)){
echo '参数错误!';
die;
}elseif($url==''){
echo '未输入要查询的域名!';
}else{
$str = file_get_contents('http://icp.chinaz.com/'.$url);
$sitenames = getSubstr($str, '', '>[');
preg_match('/(.*?)/',$str,$name);
preg_match('/(.*?)
/',$str,$nature);
preg_match('/(.*?)/',$str,$icp);
preg_match('/(.*?)
/',$sitenames,$sitename);
preg_match('/(.*?)
/',$str,$siteindex);
$time = getSubstr($str, '审核时间', ' ');
//echo $time;
preg_match('/
(.*?)
/',$time,$time);
if(strpos($str,'未备案或备案取消') == 0){
print_r(json_encode(array('name'=>$name[1],'siteindex'=>$siteindex[1],'nature'=>$nature[1],'icp'=>$icp[1],'sitename'=>$sitename[1],'img'=>'http://icp.chinaz.com'.$icp[2],'time'=>$time[1]),320));
}else{
print_r(json_encode(array('code'=> -1,'msg'=>'未查询到备案!'),320));
}
}
激活以上代码帐帖到PHP文件,浏览器运行:您的域名/baian.com?url=https://www.11dz.cn/