webeith/dnsbl

DNSBL service

dev-master 2014-07-25 15:55 UTC

This package is not auto-updated.

Last update: 2024-11-09 15:48:58 UTC


README

License Scrutinizer Code Quality Code Coverage Build Status Total Downloads

Usage Example

<?php

use Dnsbl\Dnsbl,
    Dnsbl\Resolver,
    Dnsbl\BL\Server;


$domainResolver = new Resolver\NetDnsDomainResolver();
$ipResolver = new Resolver\NetDnsIPResolver();

// Checking from url. Example how to create custom resolver.
$urlResolver = new Resolver\UrlResolver();
$urlResolver->setLocation('https://zeustracker.abuse.ch/blocklist.php?download=baddomains');

// Checking from file.
file_put_contents('zeustracker.ip.bl.file', file_get_contents('https://zeustracker.abuse.ch/blocklist.php?download=ipblocklist'));
$fileResolver = new Resolver\FileResolver('zeustracker.ip.bl.file');

$dnsbl = new Dnsbl();

$servers = array(
    new Server('zeustracker.abuse.ch',   $urlResolver,    array('domain', 'IPv4')),
    new Server('zeustracker.ip.bl.file', $fileResolver,   array('IPv4')),
    new Server('dbl.spamhaus.org',       $domainResolver, array('domain')),
    new Server('pbl.spamhaus.org',       $ipResolver,     array('IPv4'))
);

$dnsbl->setBlServers($servers);

// Checking in bl who is supported domain.
print_r($dnsbl->checkDomain('advanc320.co.vu'));

// Checking in bl who is supported IP.
print_r($dnsbl->checkIP('127.0.0.2'));

// Checking in all bl.
print_r($dnsbl->check('advanc320.co.vu'));

Installation

$> php composer.phar require webeith/dnsbl