Blog Posts per Tag

Use DNS Blacklists in PHP

The following snippet is a quick and simple way to use dnsbl in PHP code (or for CLI use), if an IP is listed the code will return 1: <?php /* * Simple DNSBL check * Author: René Moser */ // Check this IP $ip = ''; // List of DNSBL DNS Servers $dns_black_lists = file('./dnsbl.txt', FILE_IGNORE_NEW_LINES); // Reverse the IP $rev_ip = implode(array_reverse(explode('.', $ip)), '.'); $response = array(); foreach ($dns_black_lists as $dns_black_list) { $response = (gethostbynamel($rev_ip .

Read More →