note 73071 deleted from function.checkdnsrr by nlopess

From: Date: Thu, 08 Feb 2007 12:34:33 +0000
Subject: note 73071 deleted from function.checkdnsrr by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-123113@lists.php.net to get a copy of this message
Note Submitter: info at powerplant dot be ---- Check DNSBL - WIN / Linux, using a command line tool called: "arblcheck". First you need to get the arblcheck tool, you can get it here: http://www.unixwiz.net/tools/arblcheck.html Windows: Copy it into your system32 directory and make sure iis server has rights to execute cmd.exe. Linux Redhat: Dunno, did not check it... <?php // Domain to check $domain = "yousite.com"; //OR $domain = "xxx.xxx.xxx.xxx"; // List of DNSBL Checking sites $RBLSites = array( "list.dsbl.org", "multihop.dsbl.org", "unconfirmed.dsbl.org", "bl.spamcop.net", "sbl.spamhaus.org", "cbl.abuseat.org", "l2.spews.dnsbl.sorbs.net" ); // Initialize vars $cmd = "arblcheck -c"; $DNSBLError = ""; // Build the cmd string foreach($RBLSites as $site) { $cmd .= " -s " . $site; } // Add current domain $cmd .= " " . $domain; // Start the DNSBL check exec($cmd, $response); // Check response if(!empty($response)) { // If we got response foreach($response as $line) { // Check each line of the response if(eregi(".*not.*", $line)) { // Set the error $DNSBLError = "none"; } else { // Set the error $DNSBLError = "***POSSIBLE SPAM***"; break; } } } // If we have no response or a unexisting domain else { // Set the error $DNSBLError = "***POSSIBLE SPAM***"; } echo $DNSBLError; ?> Sorry I did not find the time to build this into a function, should be fairly simple :)

« previous php.notes (#123113) next »