Page 1 of 1

Domain availability function

Posted: Sun Mar 15, 2009 8:27 am
by nossie
Hello guys,

I have a small question about a domain availability function.. I'm inneed of an accurate function that returns a "1" if the checked domain is registered. At the moment im using this :

Code: Select all

 
function iswebexist($url)
{
$url = strtolower($url);
$d = gethostbyname($url);
if ($d!=$url) {return(1);}
}
?>
 
It works, but the problem is its only checking if the hostname is alive, not if its registered. Does anyone have ideas how to modify this function so that i can see results from domains that really are registered?

Thanks in advance.

Re: Domain availability function

Posted: Sun Mar 15, 2009 8:35 am
by socket1
Use the dns_get_record() function: http://us3.php.net/dns_get_record and see if the returned value is an actual IP or not

Re: Domain availability function

Posted: Sun Mar 15, 2009 9:35 am
by nossie
Can u please write the function for me? I cant get it to work :(
Thanks anyway..

Re: Domain availability function

Posted: Sun Mar 15, 2009 3:42 pm
by socket1
Take a look at the source code of this
http://ajarsource.org/domainLookup/microWhois.php

Download: http://ajarsource.org/domainLlookup/microWhois.zip

I'm not sure what you mean by "see results from domains that really are registered" but looking at that source should help you.

That script came from ... http://phptoys.com/download.php?view.5


If you can't understand that script I might write a function for checking whether a domain is registered or not, I think that's what you want.