functionsearch($keyword,$url,$page=1){
static$px=0;
$rsState=false;
$enKeyword=urlencode($keyword);
$firstRow=($page-1)*10;
if($page>10){
exit('10页之内没有该网站排名..end');
}
$contents=file_get_contents("/s?wd=$enKeyword&&pn=$firstRow");
preg_match_all('/
foreach($rs[0]as$k=>$v){
$px++;
if(strstr($v,$url)){
$rsState=true;
preg_match_all('/
)/',$v,$rs_t);
echo'当前"'.$url.'"在百度关键字"'.$keyword.'"中的排名为:'.$px;
echo'
';
echo'第'.$page.'页;第'.++$k."个进入百度";
echo'
';
echo$rs_t[1][0];
break;
}
}
unset($contents);
if($rsState===false){
search($keyword,$url,++$page);
}
}
if(isset($_POST['submit'])){
$time=explode('',microtime());
$start=$time[0]+$time[1];
$url=$_POST['url'];
if(count(explode('.',$url))<=2){
$url=ltrim($url,'http://');
$url='www.'.$url;
}
search($_POST['keyword'],$url);
}
?>
htmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""/TR/xhtml1/DTD/xhtml1-transitional.dtd">
抓取排名关键字:url地址: