我需要解析dns。这是我的 cmd 命令:
host -a google.com 8.8.8.8
或者
(host -a s4.artemisweb.jp ns0.domain_name.com
host -a s4.artemisweb.jp 77.88.8.1)
它返回类似的东西:
root@min /etc # host -a google.com 8.8.8.8
Trying "google.com"
;; Truncated, retrying in TCP mode.
Trying "google.com"
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6364
;; flags: qr rd ra; QUERY: 1, ANSWER: 24, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;google.com. IN ANY
;; ANSWER SECTION:
google.com. 300 IN A 74.125.232.103
google.com. 300 IN A 74.125.232.96
google.com. 300 IN A 74.125.232.102
google.com. 300 IN A 74.125.232.97
为了我的进一步工作,我需要
74.125.232.103 74.125.232.96 etc. ip addresses.(answer section)
其实php有
$result = dns_get_record("php.net", DNS_ANY, $authns, $addtl);
但我也有第二个参数
"8.8.8.8" or "ns0.domain_name.com or 77.88.8.1"
(并且使用此附加参数“主机”命令返回不同的 IP)并且在上面的命令中没有位置。