SyntaxHighlighter. all (); news & nbsp; | & nbsp; Security & nbsp; | & nbsp; Forum & nbsp; | & nbsp; download & nb
// Query whether a domain name exists
Function SearchDomain ($ domainName ){
// Determine whether the domain name is legal. I am not familiar with the regular expression. if that friend has more details, please refer to the following link :-)
// If (! Eregi ("*. *", $ domainName )){
// $ Re [0] = "the domain name can only contain letters, numbers, and"-"(minus signs on the keyboard). The maximum length is 26 characters.
Enter the domain name in the correct format! ";
// $ Re [1] = "the domain name does not meet the requirements! ";
// Return $ re;
//}
$ Name = strtolower ($ domainName); // small Write
If (strpos ($ name, ". cn") // if it contains a domestic domain name
$ Command = "whois-h whois.cnnic.net.cn ";
Else
$ Command = "whois ";
$ Query = EscapeShellCmd ($ command. $ name); // prevents others from playing tricks
Exec ($ query, $ whoisResult [], $ whoisReturnValue );
For ($ I = 0; $ I $ Result. = $ whoisResult [0] [$ I]."
";
$ Re [0] = $ I <30? "This domain name has not been registered. please register now! ":" This domain name has been registered by other organizations! ";
$ Re [1] = $ result;
Return $ re;
}
$ DomainName = "www.newhua.com.cn ";
$ Result = SearchDomain ($ domainName );
Print "domain name application:
";
Print $ result [0];
Print"
Query result
";
Print $ result [1];
?>