here is a little snippet i made. if you decide to change the whois.networksolutions to another registrar you may need to do a test run and see what string they use when there is no match. netsol uses There is no match for this domain, but others may use something else. you can also modify this to be a boolean function quite easity by changing "yes" to true and "no" to false.
<?php
function checkAvailability($domain)
{
$fp = @fsockopen("whois.networksolutions.com", 43, $errno, $errstr, 15);
if (!$fp) die("Could not connect to whois server.");
fputs($fp, "whois $domain\n");
(string)$result = "";
while(!feof($fp)) {
$result .= fgets($fp);
}
fclose($fp);
if (strpos(strtolower($result), "no match") !== FALSE) {
return "yes";
} else {
return "no";
}
}
$available = checkAvailability("google.com");
echo $available; //echo's no
?>
as you can see to get the availablility just call it like $available = checkAvailability("domainname.com");