Questions about port 43 of the fsockopen function

Source: Internet
Author: User
Tags net domain
For Port 43 connected to the fsockopen function, I am now working on a program for querying the whois information of the domain name. now some domain names can be queried, such as com and net domain names. Some types cannot be found. for example, if I want to query the whois information of the cn domain name, the code always fails: PHPcode $ query & quot; www.net.cn & quot ;; domain name $ server & quot; whoi to query questions about port 43 of fsockopen function connection
I am now working on a program for querying whois information. now some domain names can be queried, such as com and net domain names.

Some types cannot be found. for example, if I want to query the whois information of the cn domain name, it will always fail.

Code:

PHP code
  $ Query = "www.net.cn"; // The domain name to be queried $ server = "whois.cnnic.cn"; // whois server address $ data = ""; // initialize the final output variable value $ fp = @ fsockopen ($ server, 43); fputs ($ fp, $ query); while (! Feof ($ fp) {$ data. = nl2br (fgets ($ fp, 128);} fclose ($ fp); echo $ data;


I used a tool to check that port 43 of whois.cnnic.cn is open.

Why is the blank output?

Is there a problem with my program? Or what's wrong?

------ Solution --------------------
I remember that some queries can be blocked. Is this a problem.
------ Solution --------------------
[User: liangdong Time: 18: 20: 36 Path :~ /Php] $ telnet whois.cnnic.cn 43
Trying 218.241.97.14...
Connected to whois.cnnic.cn.
Escape character is '^]'.
Www.net.cn
Domain Name: www.net.cn
ROID: 20021209s10021s00003058-cn
Domain Status: clientDeleteProhibited
Domain Status: clientUpdateProhibited
Domain Status: clientTransferProhibited
Registrant ID: hc034904482-cn
Registrant Organization: Beijing HiChina Zhicheng Technology Co., Ltd.
Registrant Name: Wang Juan
Registrant Email: wjuan@hichina.com
Sort soring Registrar: Beijing wanwangzhicheng Technology Co., Ltd.
Name Server: ns3.hichina.com
Name Server: ns4.hichina.com
Registration Date: 00:00:00
Expiration Date: 2020-10-19 00:00:00
Dnssec Deployment: N
Connection closed by foreign host.

Telnet is acceptable. \ n is used to determine the end, $ query = "xxxx \ n"
------ Solution --------------------
Strange!
No handshake signal is sent when a session is initiated.
If you make a call, do you have to confirm who the other person is?

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.