w3-tools.com - Free Webmaster Tools and Resources
 
w3-tools.com - Free Webmaster Tools and Resources
 Free Webmaster Tools and Resources

 



PEAR Manual

This manual is provided as a courtesy. It is not an official source. Please check pear.php.net for updated information.

PEAR Manual

PEAR Manual

Introduction

Introduction -- Introduction to Net_DNSBL

Description

PEAR::Net_DNSBL provides an easy way to check a given host or URL for being listed in one or more DNSBLs.

Please not that this currently only works with IPv4 IPs.

Usage

Let's start with a simple example to check if the remote host is listed in two blacklists:

<?php
require_once 'Net/DNSBL.php';
$dnsbl = new Net_DNSBL();
$remoteIP = $_SERVER['REMOTE_ADDR'];
$remoteIP = '81.70.69.193';
$dnsbl->setBlacklists(array('sbl-xbl.spamhaus.org', 'bl.spamcop.net'));
if ($dnsbl->isListed($remoteIP)) {
    // do something
}
?>

This example shows how to check if an URL is listed in a SURBL:

<?php
require_once 'Net/DNSBL/SURBL.php';
$surbl = new Net_DNSBL_SURBL();
if ($surbl->isListed($addData['url'])) {
    // do something
}
?>
An example how to extract URLS from a text can be found on http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php and be used this way:
<?php
foreach ($extracted_urls as $surbl_check_url) {
    if ($surbl->isListed($surbl_check_url)) {
        // do something
        break;
    }
}
?>

Newsletter

Join to our newsletter and receive news and updates about our site.
Your name: 
E-mail address: 
Action: 
 

Hosted by

Search

Google
Web w3-tools.com

Links

  What is my IP? Find your IP address!     Valid XHTML 1.0 Transitional  
Copyright © 2006. by w3-tools.com. All rights reserved