How to check DNSBL automatically?

PEAR::Net_DNSBL provides an easy way to check if a given Host or URL is listed on an DNS-based Blackhole List (DNSBL, Real-time Blackhole List or RBL) or Spam URI Realtime Blocklist (SURBL).

According to PEAR::Net_DNSBL manual, you may trigger PEAR::Net_DNSBL automatically to check certain IPs that needed.

First of all, you will need to install PEAR::Net_DNSBL as command below,
pear install NET_DNSBL

By referring to the sample script from PEAR::Net_DNSBL manual, I have modified the script to be able to send an email to me when found any IPs range that needed by me as below,

With the above script, I am designing for block /24 IP range, if you need to check certain IP, replace the $ip to the exact IP and remove the for loop from line 7 and 20.

Lastly, you may add on the RBL List to the array if needed. Enjoy 🙂

Published by

Mick Genie

Mick Genie is the founder of and working at ExaBytes Network Sdn Bhd and WPWebHost web host company. He is expertise in Windows and Linux environment especially web hosting related information, tips and trick as well as the IT Information.

6 thoughts on “How to check DNSBL automatically?”

  1. I cannot get the script to run for some reason. It is returning a blank line after running this from the command line. File name is dnscheck.php

    php dnscheck.php

    1. Hi Jack,

      By default the sendmail is hidden (last 3 lines), you may remove the // to allow the email to send out.

      Otherwise, you may add these just after mail(..) and it will print from the website/shell.

      echo $message;

    1. Hi Mickey,

      Yes, the given script is the good one as it is designed the Net_DNSBL feature from the function where Net_DNSBL is just as easy to reverse checking the IP only from the provider.

Comments are closed.