Domain availability function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nossie
Forum Newbie
Posts: 2
Joined: Sun Mar 15, 2009 8:26 am

Domain availability function

Post 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.
socket1
Forum Commoner
Posts: 82
Joined: Mon Dec 08, 2008 7:40 pm
Location: Shokan, New York

Re: Domain availability function

Post 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
nossie
Forum Newbie
Posts: 2
Joined: Sun Mar 15, 2009 8:26 am

Re: Domain availability function

Post by nossie »

Can u please write the function for me? I cant get it to work :(
Thanks anyway..
socket1
Forum Commoner
Posts: 82
Joined: Mon Dec 08, 2008 7:40 pm
Location: Shokan, New York

Re: Domain availability function

Post 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.
Post Reply