将就着用X度去爬吧
1 <?php 2 echo "***************************************\r\n"; 3 echo "* SubDomain Spider *\r\n"; 4 echo "* Author:Debug0 *\r\n"; 5 echo "***************************************\r\n\r\n"; 6 if($argc<3) 7 { 8 echo "Usage:php $argv[0] Domain depth\r\n\r\n"; 9 echo "Example:php $argv[0] qq.com 101\r\n"; 10 die(); 11 } 12 $domain=$argv[1]; 13 $page=0; 14 $curl=curl_init(); 15 $output=""; 16 while($page<=$argv[2]) 17 { 18 $query="/s?wd=site%3A($domain)&pn=".$page; 19 $page+=10; //默认每页10条结果,所以翻页加10 20 $url="http://www.baidu.com".$query; 21 curl_setopt($curl, CURLOPT_URL, $url); 22 curl_setopt($curl,CURLOPT_RETURNTRANSFER,true); 23 $output.=curl_exec($curl); 24 } 25 $regexp="/g\">.*".$domain."\//i"; 26 $result=array(); 27 preg_match_all($regexp, $output, $result); 28 $result2=$result[0]; 29 foreach($result2 as $k=>$v) 30 { 31 $v=trim($v,"g\">"); 32 echo $v."\r\n"; 33 } 34 ?>
时间: 2024-11-10 13:21:23