Library code snippets

Domain scanner

This simple code collects a list of domains with a certain extension from google.com


<?
// Thx to idban 4 your grabbing tools, did you remember me? :)
//  My little hero : wulan
//
// Jakarta : September, 6 2001

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form method="post" action="<?$php_self?>">
 domain :
 <input type="text" name="domain" value="co.id">
 <br>
 <br>
 preview :
 <select name="prev" size="1">
   <option value="10" selected>10 result</option>
   <option value="20">20 result</option>
   <option value="30">30 result</option>
   <option value="50">50 result</option>
   <option value="100">100 result</option>
 </select>
 <input type="submit" name="Submit" value="Submit">
</form>
<br><br>
<?

$file=fopen("http://www.google.com/search?num=$prev&btnG=Google+Search&as_epq=$domain","r");  
if (!$file) {  
   echo "error when connect\n";  
   exit;
}
while (!feof($file)) {  
   $line = fgets($file,1024);  
   if (eregi("related:(.*)/>Similar pages", $line, $out)){  
   $i++;
   if (ereg($domain, $out[1])){
       echo $out[1]."<br>";
   }
}
fclose($file);  

?>
</body>
</html>

Comments

  1. 24 Mar 2003 at 08:09

    <?
    // Thx to idban 4 your grabbing tools, did you remember me? :)
    //  My little hero : wulan
    //
    // Jakarta : September, 6 2001


    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>


    <body bgcolor="#FFFFFF" text="#000000">
    <form method="post" action="<?$php_self?>">
    domain :
    <input type="text" name="domain" value="co.id">
    <br>
    <br>
    preview :
    <select name="prev" size="1">
      <option value="10" selected>10 result</option>
      <option value="20">20 result</option>
      <option value="30">30 result</option>
      <option value="50">50 result</option>
      <option value="100">100 result</option>
    </select>
    <input type="submit" name="Submit" value="Submit">
    </form>
    <br><br>
    <?


    $file=fopen("http://www.google.com/search?num=$prev&btnG=Google+Search&as_epq=abc","r");  
    if (!$file) {  
      echo "error when connect\n";  
      exit;
    }
    while (!feof($file)) {  
      $line = fgets($file,1024);  
      if (eregi("related:(.*)/>Similar pages", $line, $out)){  
      $i++;
      if (ereg($domain, $out[1])){
          echo $out[1]."<br>";
           }
       }
    }
    fclose($file);  


    ?>
    </body>
    </html>


    I tried exectuting the above code posted by Akas Triono Hadi ( castamaster )


    it gives me an error "error when connect " -- when fopen command is executed pliz help me rectify it


    thanx in advance


  2. 24 Mar 2003 at 07:47

    I tried the code
    "error when connect " while trying to open the file pliz help


    thanks in advance

  3. 01 Jan 1999 at 00:00

    This thread is for discussions of Domain scanner.

Leave a comment

Sign in or Join us (it's free).

Akas Triono Hadi

Related discussion

Related podcasts

  • EarthClassMail.com - Moving from LAMP to .NET 3.5

    Scott chats with Matt Davis, architect at EarthClassMail.com, about their move from a LAMP stack (Linux/Apache/mysql/PHP) to .NET 3.5. What's working, what's not, and what kinds of issues are they running into as their architect their solution.

Events coming up

  • Dec 3

    The Auckland PHP December meetup

    Auckland, New Zealand

    Topic: Magento E-Commerce platform Speaker: Robert Popovic, LERO9, Robert is the Technical Director and co-founder of LERO9. Robert attended the Electrotechnical Faculty at The University of Belgrade where he graduated with a Masters in Computer Science and Information Technology. Robert has worked exclusively in the field of web and software development throughout his career.

Want to stay in touch with what's going on? Follow us on twitter!