NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [resolved] PHP whois

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-23-2007, 10:08 AM THREAD STARTER               #1 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



PHP whois


hi

please tell me what php code do i have to write for getting the whois information of a particular domain from the registry?

i am looking for only .com and .net registries right now

thanks
champ_rock is offline  
Old 05-23-2007, 10:32 AM   #2 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
The following works for getting whois information:-

PHP Code:
<?php
$sock 
fsockopen('whois.internic.net',43);
fputs($sock,'namepros.com'."\r\n");
while(!
feof($sock))
{
    
$info .= fgets($sock,128);
}
????: NamePros.com http://www.namepros.com/programming/331121-resolved-php-whois.html

fclose($sock);
echo 
$info
?>
The result is in $info (and of course in this example the whois server is hard coded as is the domain name).
Peter is offline  
Old 05-23-2007, 11:35 AM   #3 (permalink)
Senior Member
 
dhscott's Avatar
Join Date: Apr 2006
Posts: 1,345
dhscott is a name known to alldhscott is a name known to alldhscott is a name known to alldhscott is a name known to alldhscott is a name known to alldhscott is a name known to all
 



My script checks whois.crsnic.net which should refer to each individual registrars whois server, and if it can't connect to crsnic for whatever reason, it connects to internic instead.

Same code though essentially.
dhscott is offline  
Old 05-23-2007, 11:42 AM THREAD STARTER               #4 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



please tell me which one of the two should i use ? which is better?
champ_rock is offline  
Old 05-27-2007, 07:29 AM THREAD STARTER               #5 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



i used the code and it worked perfectly

can u please explain some things to me that i fail to grasp:
1. why are we using
Code:
$info .= fgets($sock,128);
doesn't is mean $info=fgets($sock,128) . $info ?
what is the use of Concatenate here?

2. what is 128 in the fget()?

thanks
champ_rock is offline  
Old 05-27-2007, 08:07 AM   #6 (permalink)
Senior Member
 
tristanperry's Avatar
Join Date: Jan 2007
Location: Wales - United Kingdom
Posts: 1,774
tristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant futuretristanperry has a brilliant future
 




1) The concatenate is used to add the string (fgets($sock,128) to the $info variable (i.e. because then, after the loop's complete, "echo $info" can be used in one go to echo everything). But yes, "$info=fgets($sock,128) . $info" should also do the same thing.

2) The 128 is the maximum length of what's returned by the results
tristanperry is offline  
Old 05-27-2007, 09:51 AM   #7 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Yes as tristanperry stated the 128 is the amount of bytes to read at a time. The reason we specify it as the PHP manual specifies that it is more resource efficient to do so (http://php.net/fgets)

Regarding the $info .= fgets($sock,128); line it achieves exactly the same as what you wrote but is just another way of doing it.
Peter is offline  
Old 05-27-2007, 11:10 AM THREAD STARTER               #8 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



thanks guys..

but there seems to be a problem with bulk whois checkups. does any body know how to successfuly conduct checks?

thanks
champ_rock is offline  
Old 05-27-2007, 11:34 AM   #9 (permalink)
If only you knew...
 
maximum's Avatar
Join Date: Oct 2005
Location: Inside your head...
Posts: 998
maximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond repute
 


Child Abuse Special Olympics Save a Life Baby Health Autism
Originally Posted by champ_rock
thanks guys..
????: NamePros.com http://www.namepros.com/showthread.php?t=331121

but there seems to be a problem with bulk whois checkups. does any body know how to successfuly conduct checks?

thanks
The registries don't like spam-bots/email-harvesters from hitting the registry with too many requests too fast, so they place limits. PIR (the .org registry) is especially known for this. Try adding PHP's sleep() or usleep() functions in conjunction with set_time_limit() to delay each query to avoid this problem.
maximum is offline  
Old 05-27-2007, 11:36 AM THREAD STARTER               #10 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



lol email harvesting..

i thought that whois queries were generally used for checking doamin availabilities

thanks.. i will use the sleep() function
champ_rock is offline  
Old 05-27-2007, 03:56 PM   #11 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Some spammers use whois results to harvest email accounts as stated by maximum.

Another method than using usleep etc is by using more than 1 whois server and alternate between which ones you use.
Peter is offline  
Old 05-27-2007, 10:30 PM THREAD STARTER               #12 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



i guess the 2 whois servers for querying .com and .net names are crsnic and internic right?
champ_rock is offline  
Old 05-28-2007, 07:56 AM   #13 (permalink)
If only you knew...
 
maximum's Avatar
Join Date: Oct 2005
Location: Inside your head...
Posts: 998
maximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond reputemaximum has a reputation beyond repute
 


Child Abuse Special Olympics Save a Life Baby Health Autism
whois.verisign-grs.net
maximum is offline  
Old 05-30-2007, 01:37 PM   #14 (permalink)
New Member
Join Date: Mar 2007
Posts: 16
samuofm is an unknown quantity at this point
 



thanks to this thread I wrote a simple scanner last night, it alternates between 3 whois servers.
samuofm is offline  
Old 05-30-2007, 09:29 PM THREAD STARTER               #15 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



Originally Posted by samuofm
thanks to this thread I wrote a simple scanner last night, it alternates between 3 whois servers.
i gues the registry is doing some kind of updates because sometimes i am able to do bulk checks and after some days the scanner starts giving errors
champ_rock is offline  
Old 05-31-2007, 12:44 AM   #16 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Originally Posted by samuofm
thanks to this thread I wrote a simple scanner last night, it alternates between 3 whois servers.
cool glad it inspired you


Originally Posted by champ_rock
i gues the registry is doing some kind of updates because sometimes i am able to do bulk checks and after some days the scanner starts giving errors

????: NamePros.com http://www.namepros.com/showthread.php?t=331121
What sort of response are you getting from them when you get an error?
Peter is offline  
Old 06-01-2007, 07:30 AM THREAD STARTER               #17 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



here is the error
Quote:
Warning: fsockopen() [function.fsockopen]: unable to connect to whois.crsnic.net:43 in /home/XXXXXX/public_html/XXXXXX/index.php on line 11

Warning: fputs(): supplied argument is not a valid stream resource in /home/XXXXX/public_html/XXXXX/index.php on line 12

Warning: feof(): supplied argument is not a valid stream resource in /home/XXXXX/public_html/XXXX/index.php on line 13

Warning: fgets(): supplied argument is not a valid stream resource in /home/XXXX/public_html/XXXX/index.php on line 15
champ_rock is offline  
Old 06-01-2007, 08:29 AM   #18 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




That means that the whois servers are denying your connection requests. Or, a part of the network between your server and the whois server is down.
Barrucadu is offline  
Old 06-01-2007, 09:27 AM THREAD STARTER               #19 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



ya it is denying my requests.

this is happening after i check about 10-12 domains

if anyone finds a solution to this then it would be great
champ_rock is offline  
Old 06-01-2007, 01:44 PM   #20 (permalink)
NamePros Regular
 
monaco's Avatar
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 689
monaco will become famous soon enough
 



What I'd like to know is how you get around the issue of some registrar's not listing complete info in their whois registries and forcing you to use a web interface with a captcha to get the information.
__________________
My Website | My Blog
monaco is offline  
Old 06-01-2007, 09:26 PM   #21 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Originally Posted by monaco
What I'd like to know is how you get around the issue of some registrar's not listing complete info in their whois registries and forcing you to use a web interface with a captcha to get the information.
Have you got an example of such a domain that requires this?

Originally Posted by champ_rock
ya it is denying my requests.

this is happening after i check about 10-12 domains

if anyone finds a solution to this then it would be great

The only possible solutions are as follows:-

1) Find out how many queries you can make in x amount of time and use sleep or usleep to ensure you do not do too many queries.
2) Use more than 1 whois server to find the results.
3) Use a bank of proxies that will help.

The best solution is a combination of options 1 and 2. Option 3 should be avoided as it could end up you being permanently banned from using the whois server in question.
Peter is offline  
Old 06-02-2007, 06:40 PM   #22 (permalink)
NamePros Regular
 
rocko78's Avatar
Join Date: Oct 2006
Posts: 351
rocko78 is just really nicerocko78 is just really nicerocko78 is just really nicerocko78 is just really nice
 



Thanks for this tool!
Can anybody just tell how to get the available or not status? I mean if the domain is available show XXXX and if not show "YYYY"

Thanks!
__________________
Recetas de Cocina (In Spanish) | Perros Pastor Aleman (In Spanish) | Where is my sign???
rocko78 is offline  
Old 06-02-2007, 11:06 PM THREAD STARTER               #23 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



Originally Posted by peter@flexiwebhost
The only possible solutions are as follows:-

1) Find out how many queries you can make in x amount of time and use sleep or usleep to ensure you do not do too many queries.
2) Use more than 1 whois server to find the results.
3) Use a bank of proxies that will help.

The best solution is a combination of options 1 and 2. Option 3 should be avoided as it could end up you being permanently banned from using the whois server in question.
1. i do not think there is any time limit. i have tried sleep(5) and sometimes it gives me an error with that also. sometimes it runs fine even without any sleep
????: NamePros.com http://www.namepros.com/showthread.php?t=331121

2. different whois servers is definately a help. i will rotate between those three servers that u mentioned

3. proxies: i think that requires
a. more advanced coding which i am not familiar with
b. good proxies are hard to find therefore the script will hardly function when any proxy goes down
champ_rock is offline  
Old 06-02-2007, 11:25 PM   #24 (permalink)
Member
 
Dotmainer's Avatar
Join Date: Mar 2007
Posts: 1,249
Dotmainer has much to be proud ofDotmainer has much to be proud ofDotmainer has much to be proud ofDotmainer has much to be proud ofDotmainer has much to be proud ofDotmainer has much to be proud ofDotmainer has much to be proud ofDotmainer has much to be proud ofDotmainer has much to be proud of
 



are you running that on your local server ? or on real hosting ?

Maybe if its on real hosting (exp. GoDaddy) there are more
whois lookups from other machines / ppls trying to register domains etc.
__________________


Dotmainer is offline  
Old 06-02-2007, 11:49 PM THREAD STARTER               #25 (permalink)
Senior Member
 
champ_rock's Avatar
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,830
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
 



it is on a shared hosting. the servers are at "LayeredTech"

i think that might be the case. i will try to switch my hosting for this purpose. may be it will work then
champ_rock is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:48 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger