我使用gethostbyname()来检查URL的IP地址,但它返回无效的IP。
这是我的代码:
<?php
echo gethostbyname('login.sarkarijobs.xyz');
?>
返回XXX.XXX.XXX.XXX
ping login.sarkarijobs.xyz
返回ping: unknown host login.sarkarijobs.xyz
dig login.sarkarijobs.xyz
返回
; <<>> DiG 9.10.3-P4-Ubuntu <<>> login.sarkarijobs.xyz
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 20595
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;login.sarkarijobs.xyz. IN A
;; AUTHORITY SECTION:
sarkarijobs.xyz. 9043 IN SOA ns21.iserverplanet.net. info.iserverplanet.net. 2017102407 3600 7200 1209600 86400
;; Query time: 0 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Fri Nov 03 13:02:23 IST 2017
;; MSG SIZE rcvd: 113
尝试PHP: gethostbyname bug但不成功。
怎么做?