Query domain name registration (Whois)

xiaoxiao2021-03-06  94

The following is a simple WHOIS program, which is unknown to the original, which is not comprehensive enough, I hope there is a function of throwing bricks:

// This example implements top-level domain names with PHP4

IF ($ DOMAIN)

{

IF ($ DOMAIN)

{

/ / Connect to the INTERNIC Domain Name Server

$ fp = fsockopen ("rs.internic.net", 43, & $ errno, & $ errstr, 100);

IF (! $ fp)

{

Echo "$ Errstr ($ Errno)
/ N";

}

Else

{

FPUTS ($ FP, "$ DOMAIN / R / N");

While (! Feof ($ fp))

{

$ buf = fgets ($ fp, 128);

IF (EREG ("Whois Server:", $ BUF))

{

$ Server = STR_REPLACE ("Whois Server:", "", $ BUF);

$ Server = Trim ($ server);

}

}

Fclose ($ fp);

}

IF ($ server)

{

Echo " $ domain's registration server is $ server:

Echo "

";

$ fp = fsockopen ($ Server, 43, & $ Errno, & $ Errstr, 10);

IF (! $ fp)

{

Echo "cannot be connected to the 43 port of the server $ server ./N";

Echo "$ Errstr ($ Errno)
/ N";

}

Else

{

FPUTS ($ FP, "$ DOMAIN / R / N");

While (! Feof ($ fp))

{

Echo fgets ($ FP, 128);

}

Fclose ($ fp);

}

}

Else {

Echo (" $ domain is not registered.
");

}

ECHO ("
);

}

}

?>

Can only query .com, .NET and .org domain name

Enter the domain name:

转载请注明原文地址:https://www.9cbs.com/read-122112.html

New Post(0)