Home > Backend Development > PHP Tutorial > Use google to obtain the second-level domain name_PHP tutorial

Use google to obtain the second-level domain name_PHP tutorial

WBOY
Release: 2016-07-13 17:49:51
Original
1328 people have browsed it

Use google to obtain the second-level domain name_PHP tutorial


header("Content-Type: text/html;charset=utf-8");
set_time_limit(0);
error_reporting(E_ERROR);

function geturl($keywords, $page, $num)
{     
        $page = ($page - 1) * 10;      
        $content = file_get_contents("http://www.google.com/search?sclient=psy-ab&hl=en&start=$page&source=hp&q=$keywords&pbx=1&oq=$keywords&num=$num&aq=f&aqi=g4");             
        $preg = '/.*/im';                      
        preg_match_all($preg, $content, $m);       
        preg_match_all('/(.*?)/', $m[0][0], $ms);
       
        $list = array();       
        foreach ($ms[1] as $link)
        {
                preg_match('/http://[a-zA-Z0-9._-]*/', $link, $matches);               
                if (!empty($matches[0]))
                {
                        $list[] = $matches[0];
                }
        }
        $list = array_unique($list);
        return $list;
}

www.2cto.com

    echo<< ----------------------------------
Google Get DNS Info T00l 
blog:hi.baidu.com/nginxshell n
Usage:n PHP $argv[0]  n
Example:n site:baidu.com -inurl:zhidao.n
----------------------------------n
INFO;

if(file_exists('site.txt')){
  @unlink('site.txt');
  @unlink('tmp');
  echo "Clear Cache Success!rn";
  }

echo "Please Enter GoogleDork: ";
$GOOGLEDORK = urlencode(fgets(STDIN));
#echo $GOOGLEDORK;
#exit();
$page = 10;
$num = 100;
for ($i=1;$i<=$page;$i++)
{       
        $url = geturl($GOOGLEDORK, $i, $num);
        print_r('Page: '.$i.' Results Count: '.count($url)."rn");       
            foreach ($url as $u)
            {
               print_r($u."rn");
              @$fp=@fopen('tmp','a');
              @fwrite($fp,$u."rn");
              @fclose($fp);
               
            }
}  
                $new_filename='site.txt';               
                $file=file('tmp');
                $array=preg_replace('/($s*$)|(^s*^)/m','',$file); //消除空行
                foreach ($array as $key=>$r){
       
                     $array[$key]=trim("$r"); //去除空白字符
       
                    } 

               $new_array=array_values(array_unique($array));//消除重复行
                    if(file_put_contents("$new_filename",join("rn",$new_array)))
                    {
                        echo "Get Subdomain Success!rn";
                        if(file_exists('tmp'))
                        {
                            @unlink('tmp');
                            echo "Clear Cache ...";
                         }
                    }
               
                
               exit;
?>

摘自 http://hi.baidu.com/nginxshell

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478328.htmlTechArticle?php header(Content-Type: text/html;charset=utf-8); set_time_limit(0); error_reporting(E_ERROR); function geturl($keywords, $page, $num) { $page = ($page - 1) * 10; $content = file...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template