$url = parse_url($string);
$host = $url['host'];
$host = explode(".",$host);
// Normale Domain (www.google.de) oder (subdom.google.de)
if(strlen($host[0]) > 0 AND strlen($host[2]) > 0) {
if((preg_match('/^[a-zA-Z0-9\-\_]+$/',$host[1]))) {
if(!function_exists('checkdnsrr')) {
$ho = $host[1].".".$host[2];
function checkdnsrr($ho, $type = '') {
if(!empty($ho)) {
if($type == '') $type = "MX";
@exec("nslookup -type=$type $ho", $output);
while(list($k, $line) = each($output)) {
if(eregi("^$ho", $line)) {
return true;
}
}
return false;
}
}
}
if(checkdnsrr($host[1].".".$host[2].'.', 'MX') ) return true;
if(checkdnsrr($host[1].".".$host[2].'.', 'A') ) return true;
if(checkdnsrr($host[1].".".$host[2].'.', 'CNAME') ) return true;
}else { return false; }
// Normale Domain ohne www (google.de) oder (google.de)
}elseif(strlen($host[0]) > 0 AND strlen($host[2]) == 0) {
if((preg_match('/^[a-zA-Z0-9\-\_]+$/',$host[0]))) {
if(!function_exists('checkdnsrr')) {
$ho = $host[0].".".$host[1];
function checkdnsrr($ho, $type = '') {
if(!empty($ho)) {
if($type == '') $type = "MX";
@exec("nslookup -type=$type $ho", $output);
while(list($k, $line) = each($output)) {
if(eregi("^$ho", $line)) {
return true;
}
}
return false;
}
}
}
if(checkdnsrr($host[0].".".$host[1].'.', 'MX') ) return true;
if(checkdnsrr($host[0].".".$host[1].'.', 'A') ) return true;
if(checkdnsrr($host[0].".".$host[1].'.', 'CNAME') ) return true;
}else { return false; }
}else { return false; }
return false;