有时候我们需要获取网站备案信息,那么就可以用这个小偷程序来获取,ICP备案信息是从360网站身份信息查询页面抓取的。

<?php
header(“Content-type: text/html; charset=utf-8”);
//调用360网站备案信息查询接口
function icpbeian($domain) {
$domain = base64_encode ( $domain );
$opts = array (
‘http’ => array (
‘method’ => “GET”,
‘timeout’ => 5
)
);
$context = stream_context_create ( $opts );
$url = ‘http://webid.360.cn/complaininfo.php?domain=’ . $domain;
//网址输入查询:http://webid.360.cn/complaininfo.php?domain=NHU0di5uZXQ=
$html = file_get_contents ( $url, false, $context );
if (strpos ( $html, ‘未查询到网站信息’ )) {
echo “未查询到该网站的备案信息!”;
return false;
}
$flag = ‘<ul>’;
$start = strpos ( $html, $flag ) + strlen ( $flag );
$info = substr ( $html, $start, strpos ( $html, ‘</ul>’ ) – $start );
echo $info;
}

/**  START */
$domain = isset($_REQUEST[‘domain’]) ? trim($_REQUEST[‘domain’]) : ”;
if(!$domain){
echo ‘请输入一个你要查询的网址:’;
echo ‘<form action=”” name=”icp” method=”post”>’;
echo ‘<input value=”” name=”domain” type=”text” style=”width:200px; height:20px;”>&nbsp;’;
echo ‘&nbsp;<input type=”submit” value=”查询”>’;
echo ‘</form>’;
echo ”;
echo ‘说明:调用360网站身份信息接口查询ICP备案信息。’;
exit;
}
/** END */

icpbeian($domain);

?>