"Original" and then use php to query domain name whois information

Source: Internet
Author: User
"Original": before using php to query domain name whois information, a whois query tool was specially deployed on the plog.cn server to implement "plog.cn 1-6 Super-expecting to delete short domain names. PS: method of use http://plog.cn/whois/yourdomain.com

In order to implement this whois tool, I checked the information for two hours. There are many types of php implementations for whois queries on the Internet. the general idea of implementation is no exception to the following:

1. through http call xinnet or HiChina whois query interface query, and then output the results to the page, blog http://blog.163.com/mengqing_dao/blog/static/133520513201162634227882/ described by the method, is the simplest, how to call the Xinnet whois query interface indirectly

2. query the domain name directly by reading the whois server. According to the suffix of the domain name to be queried, access different whois servers and query results.

The ing between the corresponding domain name suffix-> whois server is roughly as follows:

'Com '=> 'whois .internic.net', 'net' => 'whois .internic.net ', 'org' => 'whois .pir.org ', 'Air' => 'whois .crsnic.net ', 'cn' => 'whois .cnnic.net.cn ', 'CC' => 'whois. nic. CC ',

Although this method is easy to implement, for domain names registered on the Godaddy.com platform or in Xiamen yiming.com in China, only one rough query can be found, but the actual domain information cannot be found, as follows:

Whois information of the domain name registered on godday

Whois information of the domain name registered in Xiamen yiming.com

Therefore, neither of the above two methods can fully implement the whois query function.

At this time, Jay felt that it was only the whais incident. we also needed a complete whais query component.

At this time, Jay immediately opened google.com and searched for php whois!

Baidu has searched for half a day, and there are some other technical geeks. when google searched, a complete set of php implementations of whois client appeared immediately. the project name is phpWhois. The project homepage is as follows: http://www.phpwhois.org/, so immediately download down, according to the demo in the document, soon the whois query function is achieved.

The following is the core code for calling the phpWhois component to query whois information:

  Lookup($domain);$output = implode("\n", $result['rawdata']);echo $output;?>

Here

The label defines pre-formatted text, that is, the raw text queried by whois is directly output in the original text layout format. 

DomainName: lxfq. cnROID: 20130114s10001s62921725-cnDomainStatus: okRegistrant ID: 000046 dbRegistrant: Lijun RegistrantContactEmail: 2673732891@qq.comSponsoringRegistrar: Beijing Network Technology Limited NameServer: ns1.vtopchina. cnNameServer: ns2.vtopchina. cnRegistrationDate: 2013-01-1404: 02: 16 ExpirationDate: 2014-01-1404: 02: 16 DNSSEC: unsigned

Summary:

Although whois is only the simplest query protocol based on tcp, it is a lot of work, even if we implement it very easily. if there is a ready-made php component available, we should try to avoid repeatedly inventing a wheel. It doesn't mean no, it's just a re-implementation of a protocol. even the simplest one will encounter many exceptions.

Like the phpWhois component, it is very good to deal with exceptions similar to godaddy.

Therefore, we recommend that you implement professional open-source components!

Related Article

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.