Whois的PHP代码
程序员文章站
2022-06-11 17:12:22
...
这是WHOIS查找的代码。
function whois_request($server, $query) {
$data = "";
$fp = fsockopen($server, 43);
if($fp) {
fputs($fp, $query."rn");
while(!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
return $data;
}
?>
if($action == "query") {
$data = whois_request($server, $query);
echo "Sent $query to $server.
function whois_request($server, $query) {
$data = "";
$fp = fsockopen($server, 43);
if($fp) {
fputs($fp, $query."rn");
while(!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
return $data;
}
?>
if($action == "query") {
$data = whois_request($server, $query);
echo "Sent $query to $server.
";
echo "Output:
$data
";
}
?>