How To Find The Best Domain Name


One of the most frustrating steps I face when building a new website is looking for a great domain name. Since nearly every domain name you can think of is already taken, some creativity is needed here.

So here it is: I wrote a really super cool simple php script that searches for a free domain name that uses your keyword research file as an input.

This script get as input a csv files with your keywords, and checks for every keyword whether the the domain name built from these keywords with or without hyphens is free. The result of the script is your original csv file with 2 more columns containing the domain names found.

<?php
define(‘KEYWORDS_FILE’,'keywords.csv’);
$f = @fopen(KEYWORDS_FILE, “r”);
while ($f && !feof($f))
{
    $line = trim( fgets($f, 4096));
    echo $line .”,” ;
    // find the first string in the line, that comes before the first comma
    if (preg_match(“/^([a-zA-Z0-9 ]+)/”, $line, $matches))
    {
        $keyword=$matches[1];
        // check if the domain name is available
        $domainName = str_replace(” “,”",$keyword) .”.com”;
        $ip=gethostbyname($domainName);
        if ($ip != $domainName)
        {
            echo “–,”;
        }
        else
        {
            echo $domainName .”,”;
        }
        // check if the domain name is available with hyphens
        $hyphensDomainName = str_replace(” “,”-”,$keyword) .”.com”;
        $ip=gethostbyname($hyphensDomainName);
        if ($ip != $hyphensDomainName)
        {
            echo “–,”;
        }
        else
        {
            echo $hyphensDomainName .”,”;
        }
    }
    echo “\n”;
}
fclose($f);
?>

I warmly recommend using this script, so that next time you buy a new domain name you can get your-keywords.comright away.

Notice that the script is based on gethostbyid() which checks if the domain exists and not if it is registered, so it is not 100% right.

This entry was posted in domain names, seo, web development. Bookmark the permalink.

One Response to How To Find The Best Domain Name

  1. Etone says:

    megathanks for this post! I remember when I used a free domain! it was so bad for my visitors but because i had no paypal I wasn’t able buy my own hosting So I found a site were I could get one for free.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>