I'm getting my feet wet in PHP. I tried to check the first 10 pages of the PHP forum but couldn't find the answer to the following question: How do you test if a domain is already taken or still available by way of PHP programming? Sorry if the question has already been answered previously.
Because I thought it was interesting. function domain_is_taken($domain) { static $whois; if (!isset($whois)) { include 'phpwhois-4.1.2/whois.main.php'; $whois = new Whois(); } $response = $whois->lookup($domain); return !empty($response['regyinfo']['registrar']); } PHP: Usage example: $domains = array('php.net', 'nicoswd.com', 'efwfffwer.com', 'yahahahs.com'); foreach ($domains AS $domain) { echo "{$domain} is ", domain_is_taken($domain) ? 'Taken' : 'Available', "<br />\n"; } PHP: You have to download this class though, and set the path to it right in the function. http://sourceforge.net/projects/phpwhois/
If you don't want to use the class pointed above, check this: http://www.geekpedia.com/code15_WhoIs-function-for-domain-name-info.html I posted that a few days ago. I used it to retrieve and parse the name of the domain-name owner, but you could as well use it to see if the domain-name is registered or not, depending on the response retrieved.