Powerful script to put all DOT COM and their status into a Database

by TG12
2 replies
I thought this was useful so I am releasing it into the wild!

This is completely OK... WHOIS is provided by InterNIC via port 43 for unlimited free lookups.

CREATE TABLE `domains` (
`domain` varchar(6) NOT NULL,
`len` tinyint(1) unsigned NOT NULL,
`available` tinyint(1) unsigned NOT NULL,
`expires` date NOT NULL,
`checked` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
<?php
set_time_limit(0);

= 'localhost';
= 'foo';
= 'bar';
= 'whois';

= mysql_connect(, , );
mysql_select_db();
for( = 'aaa'; <= 'zzzz'; ++)
{
= strlen();
if( = fsockopen ('whois.internic.net', 43))
{
= NULL;
fputs(, "domain .comrn");
while(!feof())
{
.= fgets(, 128);
}
fclose();
}
if(strpos(, 'No match for domain') !== FALSE)
mysql_query("INSERT INTO `domains` VALUES ('', '', 1, '0000-00-00', NULL);") or die( . ' - ' .mysql_error());
else
{
preg_match('/Expiration Date: (.+?)n/', , );
= strtotime();
= date('Y-m-d', );
mysql_query("INSERT INTO `domains` VALUES ('', '', 0, '', NULL);") or die( . ' - ' .mysql_error());
}
}
mysql_close();
?>
#database #dot #powerful #put #script #status
  • Profile picture of the author TG12
    I would have thought at least ONE person on here would have found it useful!
    Signature
    Vaoser Link Ninja Software
    DHV Delivery Systems FAILING at online dating???
    {{ DiscussionBoard.errors[5737726].message }}
  • Profile picture of the author Nochek
    The problem with that script is you are smashing their servers with a hammer to get the information you want (DDoS attack-worthy).

    You aren't respecting their robots.txt file, and your not waiting any time between scrapes. This is very poor manners, and can get your ip banned, your isp contacted, and your very own federal charges depending on how many people run this script at the same time.

    Otherwise, I do like how short and neat it is, though I might suggest adding some backup calls to some other whois systems in case internic goes down (or when they ban your ip)
    Signature
    Nochek Solutions Presents:
    The Hydrurga WSO - Rank Your Site #1 And Score Over The Penguin Updates!
    {{ DiscussionBoard.errors[5737793].message }}

Trending Topics