WHOIS query using PHP

pradeep's Avatar author of WHOIS query using PHP
This is an article on WHOIS query using PHP in PHP.
Do a WHOIS query for any domain using the script below.
Code: PHP
<form method="POST" action= "<?$_SERVER['PHP_SELF']?>">
    <label>Do a WHOIS query:</label>
    <P>
        <INPUT name="domain" SIZE="20" MAXLENGTH="22">
        <INPUT TYPE="SUBMIT" VALUE="Check name">
        <INPUT TYPE="RESET" VALUE="Clear">
    </P>
</FORM>
<hr>
<font size="2">
<?php

function whois($domain, $server="www.go4expert.com")
{
    $fp = fsockopen ($server, 43, &$errnr, &$errstr) or die("$errno: $errstr");
    fputs($fp, "$domain\n");
    while (!feof($fp))
        echo "<pre>".fgets($fp, 2048)."";
    fclose($fp);
}
If (isset ($domain))
{
    whois($domain);
}
?>
</font>
0
pipeten's Avatar, Join Date: Oct 2006
Newbie Member
I wouldn't recommend using this script without register_globals set off.
0
pipeten's Avatar, Join Date: Oct 2006
Newbie Member
Still a nice script though (no offence meant)