A simple domain name registration query program

Source: Internet
Author: User
Tags domain name registration
? Query whether there is a domain name functionSearchDomain ($ domainName) {judge whether the domain name is legal, I am not familiar with the regular expression, the friend has details, please refer to me for a read: -) if (! Eregi (*. *, $ domainName) {$ re [0] the domain name can only consist of letters, numbers, and "-" (minus signs on the keyboard), and the maximum length is 2
// 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];

?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.