I see the same thing over and over, and some people imply or suggest its easy or incredibly hard to connect and query/poll the Nominet DAC (Domain Availability Checker) to get basic data about a domain.
There are a few reasons you would want to do this, the main ones are to build a drop list database or build a drop catching script, but both are built on the same foundations.
Before you can use this, you need to be a Nominet Member, and have a DAC Subscription, but you can access the DAC Testbed for Free without Membership or Subscription.
I’m going to use a high level language for this example, which in this case is PHP, but Perl is faster, and a low level compiled language like C would be way way quicker, but PHP is more than adequate for database building and non-prime drop catching.
Basic Connect to and Poll the Dac
<?php $sock = socket_create(AF_INET, SOCK_STREAM, 0); echo "Socket Created.<br>"; socket_connect($sock , 'dac.nic.uk' , 3043); //change dac.nic.uk to testbed-dac.nominet.org.uk to access testbed. echo "Socket Connected.<br>"; socket_send ($sock, "steven.co.uk\r\n", 16, 0); echo "Message Sent.<br />"; $resp = socket_read($sock, 1000); echo "Response: $resp. <br />"; socket_send ($sock, "#exit\r\n", 9, 0); echo "Dac Session Exit Sent.<br />"; socket_shutdown($sock, 2); echo "Socket Shutdown.<br />"; socket_close($sock); echo "Socket Closed.<br />"; ?>
The above code will result in the following output, it really is as simple a half a dozen lines of code,.
Socket Created. Socket Connected. Message Sent. Response: steven.co.uk,Y,N,1998-08-18,2022-08-18,MORLEY. Dac Session Exit Sent. Socket Shutdown. Socket Closed.
You can now act upon the returned $resp variable, explode it into manageable chunks like…
$dac = split(",",$resp); echo "Split Dac. <br />";
This will return an array of 6 blocks numbered 0-5, which will be…
Array( [0] => steven.co.uk [1] => Y [2] => N [3] => 1998-08-18 [4] => 2022-08-18 [5] => MORLEY )
From here you can put it into a database…
Query a List of Names
Its most likely you would want to add some sort of loop to load a list of names…
<?php $arrList = array("steven.uk", "steven.co.uk"); $sock = socket_create(AF_INET, SOCK_STREAM, 0); socket_connect($sock , 'dac.nic.uk' , 3043); foreach($arrList as $message) { socket_send ($sock, $message . "\r\n", len($message)+4, 0); $resp = socket_read($sock, 1000); echo $resp; } socket_send ($sock, "#exit\r\n", 9, 0); socket_shutdown($sock, 2); socket_close($sock); ?>
Thats the basics covered where most people seem to strugle, its really endless where you can take a script.
I may revisit this code in future and expand on it, but for now, lets see what you do with it.
A Manchester Based Photographer and Website Developer with interests in Strongman, Fitness and Geekery.