DNSBL Check - REST API Documentation

This is the documentation for the DNSBL Check REST-API.
If you have any questions or feedback on this project, feel free to contact me.


Request:

GET https://dnsbl-check.reachcoding.eu/api/?server=8.8.8.8


Response:

Content-Type: application/json;charset=utf-8

{
    "ip":"8.8.8.8",
    "rdns":"dns.google",
    "input":"8.8.8.8",
    "results":[
        {
            "name":"Barracuda",
            "status":0,
            "lookup":"8.8.8.8.b.barracudacentral.org",
            "website":"https:\/\/barracudacentral.org\/",
            "delist":"https:\/\/www.barracudacentral.org\/rbl\/removal-request",
            "time":119
        }
    ]
}


Fields:


PHP Example:

A quick example of using this API in a PHP script:

// Domain or IP from your mail server
$server = "8.8.8.8";

// DNSBL Check API
$api = "https://dnsbl-check.reachcoding.eu/api/?server=";

// API Call
$response = @file_get_contents($api . $server);

if ($response === false) {
    echo "Error: Could not connect to API" . PHP_EOL; 
    die();
}

// Decode JSON data to array
$jsondata = json_decode($response, true);

if ($jsondata === NULL) {
    echo "Error: Could not decode JSON" . PHP_EOL;
    die ();
}

// Show API errors
if (isset($jsondata['error'])) {
    echo "Error: " . $jsondata['error'] . PHP_EOL;
    die();
}

// Show DNSBL result
foreach ($jsondata['results'] as $result) {
    switch ($result['status']) {
        case 0:
            echo "Name: " . $result['name'] . " => Status: Not listed" . PHP_EOL; 
            break;
        case 1:
            echo "Name: " . $result['name'] . " => Status: Blacklisted" . PHP_EOL; 
            break;
        case 2:
            echo "Name: " . $result['name'] . " => Status: Offline" . PHP_EOL; 
            break;
    }
}