• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Create a Whois Search

bigfiles

New Member
A Whois search is a search bar that you use for checking for info about domains, like if they are availible or if when they expire.

To add this to your site, it takes two very simple steps...

STEP ONE

Add this code to the very top of the page...make sure the web page is saved as .php


PHP:
<? if($site != "") { exec("whois $site", $output, $error); while (list(,$line) = each($output)){ echo $line, " 
n"; } } ?>


STEP TWO

Now place this code wherever you want the actual search form to appear...


Code:
<form action="" method="POST"> 
<input type="text" name="site" value=".COM .NET .ORG"> 
<input type="submit"> 
</form>


Enjoy!
 
Nice, but can I add one small part of security to your script:
PHP:
<? if($site != "") { exec("whois ".escapeshellarg($site), $output, $error); while (list(,$line) = each($output)){ echo $line, "  
n"; } } ?>
 
your example works with Linux only and it require you to have permission to use the whois program attached to Linux distribution. if you tried to google search for any whois script you're going to find tons of script and all works in Windows + Linux + it will work on your own computer if you have ( Appserv , IIS ) installed. anyway thanks for share...
 
your example works with Linux only and it require you to have permission to use the whois program attached to Linux distribution. if you tried to google search for any whois script you're going to find tons of script and all works in Windows + Linux + it will work on your own computer if you have ( Appserv , IIS ) installed. anyway thanks for share...

Colin's or bigfiles?
 
both, unless you install a whois utility for windows and place it in your PATH then that code will output "command not found" when you try to execute it on windows, most versions of linux come with a whois command built in
 
Back
Top