Jump to content

Array problem with script using PEAR Net_DNSBL


al

Recommended Posts

I'm writting simple script to test my mail server if it's listed in any of DNSBL servers and I can't get around array problem when calling $dnsbl->getDetails($serverIP).

 

It keeps adding array result line from previous server query in front of new one. In real situation DNSBL servers are pulled from MySQL. All opinions are welcome  :)

 

 

<?php
        // PEAR Net_DNSBL
        require_once 'Net/DNSBL.php';
        $dnsbl = new Net_DNSBL();

        // Test IP
        $serverIP = "127.0.0.2";
        
        // Initialize
        $rbl = $dnsbl->setBlacklists(array('b.barracudacentral.org','bl.ahbl.org'));

        // Rotate from start to end
        while ($rbl){

        // Query DNSBL servers if IP is listed
        if ($dnsbl->isListed($serverIP)) {

        // Query for details
        $detail = $dnsbl->getDetails($serverIP);

        
        // Get details out
        echo "<pre>";
        print_r($detail);
        echo "</pre>";

        } else {

        echo "NOT LISTED";

        }
}

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.