最近好像这个闹得很凶。

error_reporting(1);
if ( !$_REQUEST['ips'] )
{
echo '






自动检查beian信息系统 BETA 0.1 Bendy

请输入需要检查的IP 格式如(123.123.123.123-234)

';
exit( );
}

set_time_limit(0);
$ip_str=$_REQUEST['ips'];
$log_name="ba/".str_replace(".","_",$ip_str).".txt";
$start_ip=str_replace(strstr($ip_str,"-"),"",$ip_str);
$ips=explode(".",$start_ip);
$start=$ips[3];
$end=str_replace("-","",strstr($ip_str,"-"));
if ( !ip2long($start_ip) or !is_numeric($end) or $end > 255 or $end < $start) exit ("input wrong .please use 123.123.123-234 type") ;
$ip_str=$ips[0].".".$ips[1].".".$ips[2].".";
echo "IP地址 | 域名 | 网站名称 | 最新IP | PR值 | 百度收藏 | beian用户 | beian号
rn";
for($ipa=$start;$ipa <= $end; $ipa++)
{
$ip=$ip_str.$ipa;
$ip_url="http://ip.wen.la/?q=".$ip;
$page=file_get_contents($ip_url);
$w=info($page);
$fo=fopen($log_name,"a");
fwrite($fo,$w);
fclose($fo);
}
echo "
rn$log_name 下载";

function info($page){
$page=cut($page,"

",".

");
$ip_address=cut($page," "," ");
$page1=cut($page,"

","google_ad_client");
$page2=cut($page,"google_ad_client","

");
$tl=explode("tr onMouseOver",$page1);
$domains=array();
$out="";
for ($n=1;$n $ereg="/

(.*)

(.*) (.*)

(.*)

(.*) (.*)

(.*) if (!preg_match($ereg,$tl[$n],$match)) continue;
$domain=cut($match[2],'//','/ target=_blank');
$name=iconv("UTF-8","GBK",str_replace("|"," ",$match[3]));
$pr=cut($match[4],"images/",".gif");
$hot=strip_tags($match[5]);
$user=iconv("UTF-8","GBK",strip_tags($match[6]));
$beian=iconv("UTF-8","GBK",strip_tags($match[7]));
$ip_r=gethostbyname($domain);
$domains[]=str_replace("www.","",$domain);
$line="$ip_address|$domain|$name|$ip_r|$pr|$hot|$user|$beianrn";
$out.=$line;
echo "$ip_address | $domain | $name | $ip_r | $pr | $hot | $user | $beian
rn";
ob_flush();flush();
//echo $line;exit;
}
//part1 finished
$t2=explode("tr onMouseOver",$page2);
for ($n=1;$n $ereg="/

(.*)

(.*) (.*)

(.*)

(.*)

if (!preg_match($ereg,$t2[$n],$match)) continue;
$domain=cut($match[2],'//','/ target=_blank');
$name=iconv("UTF-8","GBK",str_replace("|"," ",$match[3]));
$pr=cut($match[4],"images/",".gif");
$hot=strip_tags($match[5]);
$ip_r=gethostbyname($domain);
$s_domain=substr($domain,strpos($domain,".")+1);
if (in_array($domain,$domains) or in_array($s_domain,$domains)) continue;
if ($s_domain == "com" or $s_domain == "cn" or $s_domain == "com.cn" or $s_domain == "net" or $s_domain == "net.cn" or $s_domain == "org" or $s_domain == "org.cn" ) $s_domain=$domain;
$temp=explode("@",get($s_domain));
$domains[]=$s_domain;
$user=$temp[0];
$beian=$temp[1];
$line="$ip_address|$domain|$name|$ip_r|$pr|$hot|$user|$beianrn";
$out.=$line;
echo "$ip_address | $domain | $name | $ip_r | $pr | $hot | $user | $beian
rn";
ob_flush();flush();
}
return $out;
}
function cut($haystack,$start,$end) {
if (strpos($haystack,$start) === false || strpos($haystack,$end) === false) {
return false;
} else {
$start_position = strpos($haystack,$start)+strlen($start);
$end_position = strpos($haystack,$end);
return substr($haystack,$start_position,$end_position-$start_position);
}
}
function get($domain){
//return "@null";查询beian信息
$url="http://211.94.161.70/baxx_ggcx_servlet?cxfs=1&ym=".$domain;
$page=file_get_contents($url);
$info=cut($page,"

if ($info == "") return "@null";
$info=str_replace("rn","",$info);
$ereg="/

(.*)

(.*)

(.*)

(.*)

/";
if(!preg_match($ereg,$info,$match)) return "null";
$name=trim(strip_tags($match[2]));
$beian=trim(strip_tags($match[3]));
$yes=trim(strip_tags($match[5]));
if ($beian <> "") return "$name@$beian";
return "$name@$yes";
}

?>