Tag Archives: Nominet

Building A Domain Drop List

Well here comes part 2, of the guide. What Do You Need is Part 1 which details the requirements, application process, etc. This article assumes you have Nominet Membership, EPP, DAC and Zonefile Access along with suitable hosting.

Drop List Building Applications

You could do this in 1 large application to handle it all, but I think that’s a mistake. Writing a collection of small tools each with a simple job, reduces server load and risk of timing out. Not to mention makes it easier to handle.

So first things first…

A Simple Database

You will need a simple database to hold the list and dates…

id(int), domain(varchar(136)), dropdate(timestamp), updated(timestamp) on update).

How simple is that database… I haven’t posted a database schema, since you may want to add Tag, Creation Date, Expiry Date, even break it down to show Keywords or Extensions, or anything else you require really. You could also include things like domain length, if it exists in other .UK family extensions and much more, so I have just given you the absolute basic.

I would personally include the domain length, the second level family extension, and possibly creation year.

Loading The List

The first small application is one which can read the 10.5 million names in the CSV and load these into the database. The odds are a shared hosting account wouldn’t be able to handle this kind of long resource hungry process, hence why you’ll need Suitable VPS hosting or similar.

This application is as simple as…

$file = "path/to.csv";
$handle = fopen($file,"r");
do{
$domain = strtolower(trim($data[0]));
$result = mysql_query("INSERT INTO `zonefile`.`droplist` (`id`, `domain`, `dropdate`, `updated`) 
VALUES (NULL, '$domain', NULL, CURRENT_TIMESTAMP);");
}
while($data=fgetcsv($handle,1000,",","'"));

This can take anywhere up to half hour I would guess, depending on the power of your server and available memory.

In order to add domain lenth, you would need to have added a length column to the database earlier. Once that’s done either with the MySQL command char_length() or the php command length(). The easiest would be…

$result = mysql_query("INSERT INTO `zonefile`.`droplist` (`id`, `domain`, `length`, `dropdate`, `updated`) 
VALUES (NULL, '$domain', CHAR_LENGTH($domain), NULL, CURRENT_TIMESTAMP);");

You could just as easily do…

$domain = strtolower(trim($data[0]));
$length = length($domain);
$result = mysql_query("INSERT INTO `zonefile`.`droplist` (`id`, `domain`,  `length`, `dropdate`, `updated`) 
VALUES (NULL, '$domain', '$length', NULL, CURRENT_TIMESTAMP);");

You’re choice entirely, adding the extension would work the same way.

Obtaining The Drop Dates

When the domain names are loaded into the database, you will need another small application to read them one by one or in clusters, poll them with the Nominet DAC, and populate the database with the returned data. Since I posted a Dac Query Snippet already, I’ll just link to that, and you can add in the MySQL and the loop yourself.

You could use something like

SELECT domain FROM 'zonefile'.'droplist' WHERE 'dropdate" IS NULL LIMIT 1400

I have selected the limit of 1400, this will take approximately 5 minutes at 200ms / 5x per second allowing for latency. A simple CRONJOB set to load the script every 5 minutes and you’re golden. You can do smaller or greater amounts but it will eat memory and resources potentially making the server sluggish. Experiment a little but remember to adjust your CRON and bear in mind the DAC limitations.

Assuming you have used my DAC Query Code and added the extra bits. You will need to use an SQL Query to extrapolate the dropdate from expiry date which is returned by the DAC. I’m going to assume you have moved the expiry into a variable, but you can work on the array value too.

UPDATE `zonefile`.`droplist` SET `dropdate` = date_add('$expiry',INTERVAL 92 DAY)
 WHERE `domain` = '$domain';

The above query updates the dropdate, where the domain matches, and adds 92 days on to the returned expiry date to create the expected drop date. You can add any other data you want based on the DAC output by adding to this query as you wish.

DAC Limitations and Rules

Now would be a good time to discus the Rules and Limitations of the Domain Availability Checker (DAC), the DAC Usage Instructions are here too.. You are limited to polling 432,000 queries per day, with a maximum of 16 names per second (1,000 per rolling minute). By queries that means ‘#limits’ or ‘#usage’ or actual domains they all count. Go over either of these limits and you will be blocked from DAC access until your quota recovers on a rolling 24 hour basis.

IF you do happen to hit a block, then the DAC will return a result like…

domain.co.uk,B,35065

A simple if…then trap, will be able to detect this and convert it from the number of seconds (35065) into a human readable time frame, I used to use this old code snippet.

if($response[1] == "B"){
	$blocktime = gmdate("G:i:s", $response[2]);
	$blocktime = explode(':', $blocktime);
	if($blocktime[0] == 00){
		$blocktime = $blocktime[1] . " minutes and ". $blocktime[2] ." seconds";
	}else{
		$blocktime = $blocktime[0] . " hours and " . $blocktime[1] . " minutes and ". $blocktime[2] ." seconds";
	}
	echo $blocktime;
	socket_send ($sock, "#exit\r\n", 9, 0);
	socket_shutdown($sock, 2);
	socket_close($sock);
	die();
}

Well that’s your drop list, built and populated with a little expense, a chunk of time and some basic coding, much of it done for you.

Depending on the efficiency of your code, server latency and some other factors, it could take up to 26 days scan the whole zone file, by this point your database would be up to 4 weeks out of date. This is because the zone file is 24 hours old when released. Part 3: Maintaining A Drop List, we will deal with this problem and work on updating the database.

What You Need to Build A Domain Drop List

Nomient Logo

Nomient Logo

This article is going to be a 4 part jobby, with a few side articles possibly, as it turned out to be somewhat longer than I expected. Most people reading this blog will know what a drop list is, but you may not know how to make one or how much effort and expense goes into it. Currently a lot less effort goes into since Nominet released the zone files. The old way will be one of the side articles I cover another time.

What is a drop list is quite a simple question; a list of domains due to expire on any given day. I’m going to talk about what you need to build one in this post, and in the next one how you build your own drop list and the costs you will likely incur in both parts. After that it will be an article on maintaining the drop list and buying drop lists in the final part. Some of the methods are hard earned lessons, which will save you time. I won’t be giving all my secrets away, some will be old methods, so there are better ways to do it, but they still work. I will also be dropping in some chunks of code too, the missing bits will be easy enough with basic coding skills which I assume you have.

Where To Start ?

Building your own drop list, isn’t too hard. It is however quite costly and time consuming, not to mention fraught with rules from Nominet. The rules are somewhat open to interpretation so I’m not going to go there, better to speak to Nominet directly about them.

Nominet Membership

Firstly a Nominet Tag is required, which is FREE, however this isn’t enough, a Nominet Membership is required. This membership costs £400+Vat to Join, then £100+Vat per year membership.

You will also need DAC Access which is £25+VAT per year, that’s the last of the Nominet costs, but not the end.

A list of Fee’s are available here… Nominet Fee Schedule, you can see the main benefit here is the cost of domains at wholesale prices, but direct access to Nominet systems is essential for list building and drop catching.

Suitable Hosting

Suitable hosting is quite subjective, but I would recommend a VPS Hosting Account. This is because shared hosting almost certainly won’t be suitable. You’ll hit your resource limits and get an get somewhat unhappy email from your host, if not asking you to upgrade or sling your hook.

A suitable VPS will cost you anywhere from £10-30 per month. This is assuming you are comfortable and able to manage a Linux Server and install PHP, MySQL, Apache and manage the required security updates yourself. Otherwise a Managed VPS will be possibly £30-80+ per month, do your own research and choose wisely.

An important factor here to remember is, unlike with Drop Catching where the speed between your server and Nominet is Critical, in this instance it doesn’t matter at all, so cheap with a decent reputation and good support is your objective.

Alternatives to VPS and Shared Hosting

I have heard of people doing this on a business hosting account, which is often half way between a low end VPS and a standard shared account or more simply a shared hosting account with more resources.

There are also a number of people who have claim they used an install of WAMP (Windows, Apache, MySQL and PHP 0r MAMP (Mac, Apache, MySQL an PHP) on a local machine, machine on their network or even on their own PC.

You could also build such a thing on a local NAS Server like a Synology NAS Server or qNAP or any other for that matter. I personally have a test environment on one of my Synology units and see no reason most 2-Bay units wouldn’t be able to handle a project of this size.

These routes are worth looking in to, but I can’t comment on any of them with regards to efficacy, as I haven’t done them.

Apply for Zone File Access

Once you’re 1, a Nominet Member with DAC Access, 2, have your hosting sorted, you need apply to Nominet for Zone File access. You have to be a Nominet Member to gain access to this. When you’ve been granted Zone File access, you need to download and process the file. I blogged on the .UK Zone File Release, to give you an idea of the process.

Nominet Zonefile Zip File Content

Nominet Zonefile Zip File Content

The file you will download is around 240mb; a zip file which contains 9 unique files inside (see right). These are individual Zone File for each available extension under the .UK ccTLD, all managed by Nominet. Exacting them all will consume just over 1.5GB of storage, more or less depending on destination disk format.

Even though there are 9 files in the archive there are only 2 types of file.

1, Zone Files, these contain details about the zone, along with domains and their name servers. We won’t be using these, for drop lists we don’t need name servers.

2, Database Dump, which is a Comma Separated Value (CSV) file.

The CSV file is a literally just a list of domains, with nothing in there which makes it very very easy to process and quite fast. It will look like the list below…

domain1.co.uk
domain2.co.uk
domain3.net.uk
domain4.org.uk
domain5.uk

Its important to note, neither the individual zone files, or the database dump contain any dates, tags or anything more other than domain names or domain names, zone data and name servers.

In Part 2, I will discuss bringing the above together to actually build a drop list.

.UK Family Whois Splitter

I were looking for a snippet of code for someone when I came across an old tool. This isn’t a parser or a tool like phois or similar, its just a usable snippet of code to do a job. Really I should update it, and maybe use a function to handle the job, but it works just fine for its use.

The job in this instance were to monitor my domains for changes in status, in a few situations.

1, When a domain were sold, I monitored the tag and registrant name (now I’m using the DAC I only monitor the tag for .uk).
2, When using another registrar/registry I monitored expiry to avoid losing domains due to non-renewal or errors.

In order to do this, I needed code to (1), connect to a whois server (this is easy),  (2), split the required bits of info from the result (not so easy) and (3), place it in a database (easy). Then work on the data from there, (4), load the “watched”, “sold” or “close to expiry” domains, (5), scan the whois and compare, then (6), act on the result.

90% of the various registries whois outputs, out there are fairly uniform, but much like Nominets EPP, their whois is non-standard, so I needed a custom splitter. I’m not sure I would do it the same if I wrote the code now… some years later.

I have updated the code a little to include a ROFR (Right of First Refusal) detection, this won’t be needed come june (2019) when the period expires.

switch(trim($ext)){
	case "uk":
		$def = array();
		if(preg_grep("/Right of reg/", $arr)){
			$def['domain'] = $arr[1];
			$def["rofr"] = $arr[3]; 
			$type = "rofr";			
			break;	
		}

		$def['domain'] = $arr[1];
		$def['registrant'] = $arr[3]; 

		preg_match('/Tag = (.*)]/', $res, $matches);
		$def['tag'] = trim($matches[1]);
			
		preg_match("/Registered on: (.*)/", $res, $matches);
		$def['created'] = date("Y-m-d",strtotime(trim($matches[1])));
			
		preg_match("/Last updated: (.*)/", $res, $matches);
		$def['updated'] = date("Y-m-d",strtotime(trim($matches[1])));
				
		preg_match("/Expiry date: (.*)/", $res, $matches);
		$def['expiry'] = date("Y-m-d",strtotime(trim($matches[1])));

		$type = "uk";	
		break;

	default:
		break;
}

This will produce an array called $def, which when calling a valid name would look like…

Array
(
    [domain] => steven.uk
    [registrant] => Steve Morley
    [tag] => MORLEY
    [created] => 2014-06-12
    [updated] => 2016-02-29
    [expiry] => 2024-06-12
)

or if the the .UK has right of first registration intact…

Array
(
    [domain] => steven.uk
    [rofr] => steven.co.uk
)

Working from this array, you can you can put these into a database, compare them to the database return and act on it from there. I suggest sending yourself an email or text message (api’s are easy to follow).