[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 05-23-2007, 09:08 AM   #1 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 05-23-2007, 09:32 AM   #2 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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);
}

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, 10:35 AM   #3 (permalink)
Senior Member
 
dhscott's Avatar
 
Join Date: Apr 2006
Location: London, UK
Posts: 1,346
228.75 NP$ (Donate)

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, 10:42 AM   #4 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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?
__________________
Akshay Jain
......................
champ_rock is offline  
Old 05-27-2007, 06:29 AM   #5 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 05-27-2007, 07:07 AM   #6 (permalink)
Senior Member
 
tristanperry's Avatar
 
Join Date: Jan 2007
Location: Wales - United Kingdom
Posts: 1,328
357.00 NP$ (Donate)

tristanperry is a splendid one to beholdtristanperry is a splendid one to beholdtristanperry is a splendid one to beholdtristanperry is a splendid one to beholdtristanperry is a splendid one to beholdtristanperry is a splendid one to beholdtristanperry is a splendid one to behold


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
__________________
Devoted Hosting
High Quality Shared And Reseller Hosting
cPanel, 24/7 support, 99.9% uptime guaranteed
tristanperry is online now  
Old 05-27-2007, 08:51 AM   #7 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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, 10:10 AM   #8 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 05-27-2007, 10:34 AM   #9 (permalink)
If only you knew...
 
maximum's Avatar
 
Join Date: Oct 2005
Location: Inside your head...
Posts: 919
128.65 NP$ (Donate)

maximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant future

Child Abuse Special Olympics Save a Life Baby Health Autism
Quote:
Originally Posted by champ_rock
thanks guys..

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, 10:36 AM   #10 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 05-27-2007, 02:56 PM   #11 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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, 09:30 PM   #12 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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?
__________________
Akshay Jain
......................
champ_rock is offline  
Old 05-28-2007, 06:56 AM   #13 (permalink)
If only you knew...
 
maximum's Avatar
 
Join Date: Oct 2005
Location: Inside your head...
Posts: 919
128.65 NP$ (Donate)

maximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant future

Child Abuse Special Olympics Save a Life Baby Health Autism
whois.verisign-grs.net
maximum is offline  
Old 05-30-2007, 12:37 PM   #14 (permalink)
New Member
 
Join Date: Mar 2007
Posts: 16
0.00 NP$ (Donate)

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, 08:29 PM   #15 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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


Quote:
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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 05-30-2007, 11:44 PM   #16 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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
Quote:
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


Quote:
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

What sort of response are you getting from them when you get an error?
Peter is offline  
Old 06-01-2007, 06:30 AM   #17 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 06-01-2007, 07:29 AM   #18 (permalink)
Barru.
 
Barrucadu's Avatar
 
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,731
78.50 NP$ (Donate)

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, 08:27 AM   #19 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 06-01-2007, 12:44 PM   #20 (permalink)
NamePros Regular
 
monaco's Avatar
 
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 695
314.80 NP$ (Donate)

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, 08:26 PM   #21 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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
Quote:
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?

Quote:
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, 05:40 PM   #22 (permalink)
NamePros Regular
 
rocko78's Avatar
 
Join Date: Oct 2006
Posts: 350
921.65 NP$ (Donate)

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, 10:06 PM   #23 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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


Quote:
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

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
__________________
Akshay Jain
......................
champ_rock is offline  
Old 06-02-2007, 10:25 PM   #24 (permalink)
NamePros Regular
 
zoki's Avatar
 
Join Date: Mar 2007
Posts: 888
222.43 NP$ (Donate)

zoki is a splendid one to beholdzoki is a splendid one to beholdzoki is a splendid one to beholdzoki is a splendid one to beholdzoki is a splendid one to beholdzoki is a splendid one to beholdzoki is a splendid one to behold

Ethan Allen Fund
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.
__________________
Patience is your best friend in this business! (© by Gene)
zoki is offline  
Old 06-02-2007, 10:49 PM   #25 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

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
__________________
Akshay Jain
......................
champ_rock is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:49 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85