Here's how I done it
$domain would be like "linksuk", and $tld would be like "com"
$domain = $_REQUEST['domain'];
$tld = $_REQUEST['tld'];
$replacements = array("http://","www",".","com","net","org");
eregi_replace($replacements,"",$domain);
if( !empty($domain) && !empty($tld) ) {
$data = array();
$lines = file("http://www.whois.net/checkDomain.cgi2?domain=".$domain."&tld=".$tld,"rb");
foreach($lines as $lineNum => $line) {
if($lineNum == 28) {
if(strip_tags($line) == "Domain Name ".$domain.".".$tld." is available!\n") {
$registered = 0;
}else {
$registered = 1;
$continue = 0;
$info = "";
$Wlines = file("http://www.whois.net/whois.cgi2?d=".$domain.".".$tld,"rb");
foreach($Wlines as $WlineNum => $Wline) {
if(htmlspecialchars(strip_tags($Wline,"<pre>")) == "WHOIS information for ".$domain.".".$tld.":<pre>\n") {
$continue = 1;
}
if($continue == 1) { $info .= strip_tags($Wline); }
if(htmlspecialchars(strip_tags($Wline,"<pre>")) == "</pre>\n") {
$continue = 0;
}
}
}
}
}
if($registered == 0) { echo "Domain Name ".$domain.".".$tld." is available!"; }else { echo 'Sorry, the domain name "'.$domain.'.'.$tld.'" has already been registered<br /><br />'; }
Then to show the user the details on the domain name entered (if its already taken) you'd simply add in something like
echo nl2br($info);
Hope that helps you