• For doing basic RBL (Real Time Blacklist) lookups with this function do:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <?
    $host = '64.53.200.156';
    $rbl = 'sbl-xbl.spamhaus.org';

    // valid query format is: 156.200.53.64.sbl-xbl.spamhaus.org
    $rev = array_reverse(explode('.', $host));
    $lookup = implode('.', $rev) . '.' . $rbl;

    if ($lookup != gethostbyname($lookup)) {
    echo "ip: $host is listed in $rbl\n";
    } else {
    echo "ip: $host NOT listed in $rbl\n";
    }
    ?>
    Prev:
    PHP:: Telnet
    Next:
    PHP:: Finger