在线演示
https://www.nta6.com/me/beian/?url=qq.com
使用方法
1.创建一个php文件,比如beian.php,将下方代码复制
2.访问接口 :域名/beian.php?url=
API接口代码
<?php
/**
* 0en.cn
*/
error_reporting(0);
$u = $_GET['url'];
var_dump();
if(!isset($u)){
echo '?url=qq.com';
die;
}
$a = file_get_contents('http://icp.chinaz.com/info?q='.$u);
$p = '/<td align=\"left\" class=\"by1\" width=\"30%\">(.*?)<\/td>/';
preg_match_all($p,$a,$m);
$p1 = '/<td align=\"left\" class=\"by2\" width=\"30%\">(.*?)<\/td>/';
preg_match($p1,$a,$m1);
$p2 = '/<td width=\"29%\" align=\"left\" class=\"by1\">(.*?)<\/td>/';
preg_match($p2,$a,$m2);
$p3 = '/<td align=\"left\" class=\"by2\">(.*?)<\/td>/';
preg_match($p3,$a,$m3);
$p4 = '/<td align=\"left\" class=\"by2\" width=\"30%\" id=\"mpage\">(.*?)<\/td>/is';
preg_match($p4,$a,$m4);
$p5 = '/<td align=\"left\" class=\"by1\">(.*?)<\/td>/';
preg_match_all($p5,$a,$m5);
$data['备案号'] = $m[1][0];
$data['网站名称'] = $m[1][1];
$data['审核时间'] = $m1[1];
$data['主办单位'] = $m2[1];
$data['主办单位性质'] = $m3[1];
$data['网站首页地址'] = $m4[1];
$data['网站备案/许可证号'] = $m5[1][1];
if(strpos($m[0][0],'-') == 41){
$arr = ['code'=>500,'msg'=>'未备案'];
print_r(json_encode($arr,JSON_UNESCAPED_UNICODE));
}else{
print_r(json_encode($data,JSON_UNESCAPED_UNICODE));
评论 (0)