PHP bulk .com availabilty?

SpaceshipSpaceship
Watch

nick-8318

Established Member
Impact
23
How can I use PHP to bulck check available domain names?

I want to go through a list of 2,000 words and add things like "fans" to the end of them to see if they are available.

example:

word1fans.com
word2fans.com
etc...all the way to word2000fans.com
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
for($i = 0; $i <= '2000'; $i++)
{
  echo 'word'.$i.'fans.com<br>';
}

Would get you word1fans.com etc.. You could substitute the echo'ing with some php function/script that returns "Available" or "Registered". Plenty of php whois scripts out there.. ;)

EDIT:

You could use something like this
PHP:
<?php

$whois_servers = array('com' => 'whois.verisign-grs.net',
                       'net' => 'whois.verisign-grs.net',
                       'org' => 'whois.publicinterestregistry.net',
                       'info' => 'whois.afilias.info',
                       'biz' => 'whois.neulevel.biz'
                      );

function whois($query)
{
  global $whois_servers;
  
  $available = "No match";
  $available2 = "Not found";
  
  $query = str_replace("http://", "", $query);
  
  if(substr($query, 0, 4) == 'www.')
  {
    $query = substr($query, 4);
  }
  
  $check = explode(".", $query);
  $ext = trim($check[1]);

  reset($whois_servers);
  $server = $whois_servers[$ext];

  $fp = fsockopen($server, 43);

  if(!$fp)
  {
    die('Could Not Connect To Server.');
  }
  else
  {
    $send = fputs($fp, $query."\r\n");

    if(!$send)
    {
      die('Unable to send request.');
    }
    else
    {
      while(!feof($fp))
      {
        $result .= fgets($fp, 10240);
      }

      if(eregi($available, $result) || eregi($available2,$result))
      {
        return $query.' is available.';
      }
      else
      {
        return $query.' is registered.';
      }
      fclose($fp);
    }
  }
}
?>

PHP:
for($i = 0; $i <= '2000'; $i++)
{
  echo whois('word'.$i.'fans.com')."<br>\n";
}

Output (only went with 10)
Code:
word0fans.com is available.
word1fans.com is available.
word2fans.com is available.
word3fans.com is available.
word4fans.com is available.
word5fans.com is available.
word6fans.com is available.
word7fans.com is available.
word8fans.com is available.
word9fans.com is available.
word10fans.com is available.
 
Last edited:
0
•••
works like a charm

thanks!
 
0
•••
Wow SV, nice job. I had no idea how to check whois stuff, but you did it. Thanks a lot SV.
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back