PHP/Network/DNS

Материал из Web эксперт
Перейти к: навигация, поиск

Check DNS error

<?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]!";
?>



Get MX records corresponding to a given Internet host name

<?php
   getmxrr("www.wbex.ru",$mxhosts);
   print_r($mxhosts);
?>



getservbyname: get server by name

<?php
   echo "HTTP"s default port number is: ".getservbyname("http", "tcp");
?>



getservbyport: get server by port

<?php
   echo "Port 80"s default service is: ".getservbyport(80, "tcp");
?>