<?php /*Simply place the code whois($domain,$ext); in any page and create a form with the fields domain and extension. A sample is listed below. You could add the whois($domain,$ext); to the bottom of this script and point a form to it and you will get the whois results. Please not the http://www. is not required. */ /*Form example: <form action="http://mydomain.com/whois.php" method="post">Domain:(http://www.)<input type="text" name="domain"><br>Extension: <select name="ext"> <option value=".co.uk">.co.uk</option> <option value=".com">.com</option> <option value=".biz">.biz</option> <option value=".fr">.fr</option> <selected>Please choose one..</selected> </select> <br><input type="submit" name="submit" value="look-up"> </form> */ extract($_POST); function whois($domain,$ext){ $url=$domain.$ext; switch($ext){ case ".co.uk": $whois = "whois.nic.uk"; break; case ".com": $whois = "whois.networksolutions.com"; break; case ".fr": $whois = "whois.nic.fr"; break; case ".biz": $whois = "whois.biz"; break; default: $whois = "whois.networksolutions.com"; } if (trim($url) <> "") { $url = trim($url); $f = fsockopen($whois, 43, $errno, $errstr, 30); if (!$f) { echo "Connection To Server Failed ($errno)"; } else { fputs($f, "$url\r\n"); print "<pre>\r\n"; while (!feof($f)) { echo fread($f,128); } print "</pre>"; fclose($f); } }else{ echo "Invalid domain entered"; } } ?>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.