A simple domain name registration case Query Program _php Foundation

Source: Internet
Author: User
Tags domain name registration
?

Query if a domain name exists
function Searchdomain ($domainName) {
To determine whether the domain name is legitimate, I am not familiar with the formal expression, the friend has detailed information, may wish to borrow me a read:-)
if (!eregi ("*.*", $domainName)) {
$re [0]=] domain names can only be letters, numbers, and "-" (a minus sign on the keyboard), with a maximum length of 26 characters. <br> please fill in the correct format domain name! ";
$re [1]=] domain name does not meet the requirements! ";
return $re;
// }

$name =strtolower ($domainName); Turn lowercase
if (Strpos ($name, ". CN"))//If a domestic domain name is included
$command = "Whois-h whois.cnnic.net.cn";
Else
$command = "Whois";

$query =escapeshellcmd ($command. $name); To prevent anyone from doing anything.
EXEC ($query, $whoisResult [], $whoisReturnValue);

for ($i =0; $i <count ($whoisResult [0]); $i + +)
$result. = $whoisResult [0][$i]. " <br> ";

$re [0]= $i <30?] This domain name has not yet been registered, please register immediately! ":" 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 situation:<br>";
Print $result [0];
Print "<BR> query results <BR>";
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.