PHP/Network/DNS — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:06, 26 мая 2010
Содержание
Check DNS error
<source lang="html4strict">
<?php
$email = "j@wbex.ru"; $domain = explode("@",$email); $valid = checkdnsrr($domain[1], "ANY"); if($valid) echo "The domain has an MX record!"; else echo "Cannot locate MX record for $domain[1]!";
?>
</source>
Get MX records corresponding to a given Internet host name
<source lang="html4strict">
<?php
getmxrr("www.wbex.ru",$mxhosts); print_r($mxhosts);
?>
</source>
getservbyname: get server by name
<source lang="html4strict">
<?php
echo "HTTP"s default port number is: ".getservbyname("http", "tcp");
?>
</source>
getservbyport: get server by port
<source lang="html4strict">
<?php
echo "Port 80"s default service is: ".getservbyport(80, "tcp");
?>
</source>