Have you interest to install who is lookups on domain names. Here is an exciting php script you need to install.
Steps to install.
1.
<?php
function whois ($query, $server = “whois.internic.net”) {
$handle = fsockopen ($server, 43);
fwrite ($handle,$query);
while (!feof ($handle)) {
$results .= fread ($handle, 102400);
}
if ($server == ‘whois.internic.net’) {
preg_match (‘#Whois Server: (.*)#’, $results, $matches);
$results = whois ($query, $matches[1]);
}
return $results;
}
echo whois ($_REQUEST[‘domain’]);
?>
For Linux Server use this code :
<?php
$domain = $_REQUEST[‘domain’];
$output = shell_exec(“whois $domain”);
echo $output;
?>
Copy this code and paste it in a file called whois.php in your root directory
2. Open the web browser type http://www.yourdomain.com/whois.php?domain=http://www.anydomain.com
Now you can check who is of any domain from your site.
Enjoy coding. 🙂
Those who want to add a class for whois Download from here
4 comments
Comments feed for this article
May 15, 2007 at 4:52 am
susenjit
Hi,
this is a good script u have written. But I am concerned about certain things.
Firstly, u r using file handling operation directly in the WHOIS server, is it a secured process? I mean to say will WHOIS server allow this?
Secondly, is there any limitation on the number of times u can do query to the WHOIS server?
I think these issues are very important.
regards,
Susenjit
June 21, 2007 at 10:09 am
Prabhat
I agree with “is there any limitation on the number of times u can do query to the WHO IS server?”
Yes, there is restriction’s if you query the WHOIS server more than specified number of times per day, then there will be automatically Your IP is blocked. So be aware.
June 21, 2007 at 10:34 am
Subikar
Yes there are many restrictions everywhere, but for experimental purposes you can use the code instead of visitng the other website. You can view the site details from your own website.
February 18, 2008 at 9:11 am
test
shall i use the above code in windows server.i have an error msg if i use the code directly into php