note 35311 rejected from function.checkdnsrr by iridium
| From: | iridium@php.net | Date: | Tue, 22 Jun 2004 06:49:01 +0000 |
| Subject: | note 35311 rejected from function.checkdnsrr by iridium | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71480@lists.php.net to get a copy of this message | ||
Note Submitter: NATURALISTE@optusnet.com.au
----
maybe usefull, a blacklist (DNSBL) check function:
function is_blacklisted($ip) {
$dnsbl_check=array("bl.spamcop.net",
"relays.osirusoft.com",
"list.dsbl.org",
"sbl.spamhaus.org");
if ($ip) {
$quads=explode(".",$ip);
$rip=$quads[3].".".$quads[2].".".$quads[1].".".$quads[0];
for ($i=0; $i<count($dnsbl_check); $i++) {
if (checkdnsrr($rip.".".$dnsbl_check[$i],"A")) {
$listed.=$dnsbl_check[$i]." ";
}
}
if ($listed) { return $listed; } else { return FALSE; }
foreach ($result as $line) (if(eregi("^$hostName",$line)) {
return true;
}
}
}}
kriek at jonkriek dot com
26-Mar-2003 10:08
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
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;
} foreach ($result as $line) (if(eregi("^$hostName",$line)) {
return true;
if ($ip) {
$quads=explode(".",$ip);
$rip=$quads[3].".".$quads[2].".".$quads[1].".".$quads[0];
for ($i=0; $i<count($dnsbl_check); $i++) {
if (checkdnsrr($rip.".".$dnsbl_check[$i],"A")) {
$listed.=$dnsbl_check[$i]." ";
}