RSS Feed

Check Domain Availability Automatically

October 28, 2011 by ktorktor

I’m following, for some time, a domain name that has been registered by somebody else. The former owner didn’t renew the domain so it will be available for registration soon. Usually it takes around 75 day from the expiration date until the domain name becomes available again. I can use a paid service like, they are among the best. They can grab the domain for you just in the moment it becomes available. It is an auction based system and you have bet a minimum of $69.

I want to register the domain at a regular price so I made a small script to send me an email when it becomes available. I am aware that my system will never beat systems like snapmanes, but I’ll be able to register it from the fist minutes it becomes available. This is just a similar name of a domain that I already have so it is not very important and it doesn’t worth paying $69 for it.

I found a domain lookup class on Then I made a small php script:

Just change $domain and $email with your own.


$domain = '';
$email = '';

include "whois.php";
$whois = new whois;

if ($whois->available($domain)) {
	echo 'Available!';

	if (!file_exists("sent.txt")) send_mail();

} else {

	echo 'Not Available!';

function send_mail() {

	global $domain;

	$to = $email;
	$subject = "$domain is Available!";
	$body = "$domain is Available!";
	if (mail($to, $subject, $body)) {
	   echo("<p>Message successfully sent!</p>");
	 } else {
	   echo("<p>Message delivery failed...</p>");

	 file_put_contents ("sent.txt","sent");



Download files

When the domain becomes available, it will send you an email and then writes a file “sent.txt”. Next time it will check if the file exists before sending email, in order to avoid flooding your inbox.

Put the script on a server and set up a cron (form 5 to 5 minutes) like this: /usr/bin/lynx -source

No Comments »

No comments yet.

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>