background image

于数字计算),或用 IP 地址表示数字格式

时,应用这些函数。

echo long2ip(-655395948);

?>
输出:
-655395948
216.239.115.148

 checkdnsrr

($host, 

$type)

 该函数在 DNS 中检查与$host 主机相符的
$type 类型记录,如发现,即返回布尔真值。

用此函数检查主机中是否存在某个特定的
DNS 记录类型。

 代码:
<?php

$ret = checkdnsrr
('techrepublic.com', SOA);

if ($ret) {
echo 'SOA records 

exist for host';
} else {

echo 'SOA records do 
not exist for host';

}
?> 
输出:
SOA records exist for host

  dns_get_re

cord
($host, 

$type)

 该函数返回$host 主机的 DNS 记录。可选的
$type 参数只可用来恢复那些与一个特定的

类型匹配的子集。

用此函数恢复某个特殊主机的详细 DNS 记

录。

 代码:

<?php
$data = dns_get_record

('techrepublic.com');
print_r($data);

?>
输出:
Array
(
[0] => Array
(
[host] => 
techrepublic.com
[type] => MX
[pri] => 500
[target] => 
c10-mail.cnet.com
[class] => IN
[ttl] => 10756
)
[1] => Array
(
[host] => 
techrepublic.com
[type] => NS
[target] => 
ns3.cnet.com
[class] => IN