Jump to content
php.lv forumi

Domeina pārbaude


fin

Recommended Posts

un tur pat tālāk komentāros:

The checkdnsrr function is not implemented on the Windows platform. The way to get around this problem is to write your own version of checkdnsrr. Example: myCheckDNSRR

 

<?php
function myCheckDNSRR($hostName, $recType = '')
{
if(!empty($hostName)) {
  if( $recType == '' ) $recType = "MX";
  exec("nslookup -type=$recType $hostName", $result);
  // check each line to find the one that starts with the host
  // name. If it exists then the function succeeded.
  foreach ($result as $line) {
 if(eregi("^$hostName",$line)) {
   return true;
 }
  }
  // otherwise there was no mail handler for the domain
  return false;
}
return false;
}
?>

 

Note that the type parameter is optional, and if you don't supply it then the type defaults to "MX" (which means Mail Exchange). If any records are found, the function returns TRUE. Otherwise, it returns FALSE.

Link to comment
Share on other sites

×
×
  • Create New...