Alright I've designed a form that post information for wwwhois lookup. I have 6 nameservers listed with radio buttons in the group value of nameserver and individual values as the path of the name server example of one I have:
<input type="radio" value="whois.nic.gov" name="nameserver">
Now I have function for the wwwhois here:
function wwwhois($target){
$server = $namesever;
message("<p><b>WWWhois Results:</b><blockquote>");
$target = gethostbyaddr($target);
if (! eregi("[a-zA-Z]", $target))
$msg .= "Can't WWWhois without a domain name.";
else if (!eregi(".com|.net|.org|.edu|.ca|.uk|.co.uk|.au|.de", $target))
$msg .= "I currently only support .com, .net, .org, .edu, .uk, .co.uk, .au, and .de";
else{
message("Connecting to $server...<br><br>");
if (! $sock = fsockopen($server, 43, &$num, &$error, 10)){
unset($sock);
$msg .= "Timed-out connecting to $server (port 43)";
}
else{
fputs($sock, "$target\n");
while (!feof($sock))
$buffer .= fgets($sock, 10240);
}
fclose($sock);
if(! eregi("Whois Server:", $buffer)){
if(eregi("no match", $buffer))
message("NOT FOUND: No match for $target<br>");
else
message("Ambiguous query, multiple matches for $target:<br>");
}
else{
$buffer = split("\n", $buffer);
for ($i=0; $i<sizeof($buffer); $i++){
if (eregi("Whois Server:", $buffer[$i]))
$buffer = $buffer[$i];
}
$nextServer = substr($buffer, 17, (strlen($buffer)-17));
$buffer = "";
message("Deferred to specific whois server: $nextServer...<br><br>");
if(! $sock = fsockopen($nextServer, 43, &$num, &$error, 10)){
unset($sock);
$msg .= "Timed-out connecting to $nextServer (port 43)";
}
else{
fputs($sock, "$target\n");
while (!feof($sock))
$buffer .= fgets($sock, 10240);
fclose($sock);
}
}
$msg .= nl2br($buffer);
}
$msg .= "</blockquote></p>";
message($msg);
}
now $server = $nameserver; use to be $server = "rs.internic.net";
When I tried to execute this on my site for testing I got a sparse error like this:
Warning: Unable to find file identifier 0 in /home/knight/scriptparadise-www/hvnqt/indextest.php3 on line 184
Ambiguous query, multiple matches for dvnull.org:
What have I done wrong?