programatically check if a domain is availible?
Posted
by acidzombie24
on Server Fault
See other posts from Server Fault
or by acidzombie24
Published on 2010-01-04T01:05:42Z
Indexed on
2010/03/13
9:15 UTC
Read the original article
Hit count: 317
Using this solution http://serverfault.com/questions/98940/bot-check-if-a-domain-name-is-availible/98956#98956 I wrote a quick script (pasted below) in C# to check if the domain MIGHT be available. A LOT of results come up with taken domains. It looks like all 2 and 3 letter .com domains are taken and it looks like all 3 letter are taken (not including numbers which many are available). Is there a command or website to take my list of domains and check if they are registered or available?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.IO;
namespace domainCheck
{
class Program
{
static void Main(string[] args)
{
var sw = (TextWriter)File.CreateText(@"c:\path\aviliableUrlsCA.txt");
int countIndex = 0;
int letterAmount=3;
char [] sz = new char[letterAmount];
for(int z=0; z<letterAmount; z++)
{
sz[z] = '0';
}
//*/
List<string> urls = new List<string>();
//var sz = "df3".ToCharArray();
int i=0;
while (i <letterAmount)
{
if (sz[i] == '9')
sz[i] = 'a';
else if (sz[i] == 'z')
{
if (i != 0 && i != letterAmount - 1)
sz[i] = '-';
else
{
sz[i] = 'a';
i++;
continue;
}
}
else if (sz[i] == '-')
{
sz[i] = 'a';
i++;
continue;
}
else
sz[i]++;
string uu = new string(sz);
string url = uu + ".ca";
Console.WriteLine(url);
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "nslookup ";
p.StartInfo.Arguments = url;
p.Start();
var res = ((TextReader) new StreamReader( p.StandardError.BaseStream)).ReadToEnd();
if (res.IndexOf("Non-existent domain") != -1)
{
sw.WriteLine(uu);
if (++countIndex >= 100)
{
sw.Flush();
countIndex = 0;
}
urls.Add(uu);
Console.WriteLine("Found domain {0}", url);
}
i = 0;
}
Console.WriteLine("Writing out list of urls");
foreach (var u in urls)
Console.WriteLine(u);
sw.Close();
}
}
}
© Server Fault or respective owner