PHP code example of clash82 / cachedhttpbl

1. Go to this page and download the library: Download clash82/cachedhttpbl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

clash82 / cachedhttpbl example snippets




// suspicious IP address (fill this with the IP address you want to check)
$ip = '';

// valid http:BL API key (you can create one at http:BL dashboard)
// keep it mind that there's no way to validate this key, so make
// sure you have entered a valid key
$httpblApiKey = '';

// we are using namespace autoloader


try {
    // fetch response data from http:BL service
    $response = $cachedHttpBl->checkIP($ip);

    // additional translator to output more details about the Response (useful, but not  $response->getThreat(),
        $translator->getThreatDescription()
    );

    printf(
        'Type meaning code: %d (%s)'.\PHP_EOL,
        $response->getTypeMeaning(),
        $translator->getTypeMeaningDescription()
    );

    // write cache for further usage
    $adapter->writeCache();
} catch (\Exception $e) {
    printf('Something went wrong or no details about the given IP address were found: %s', $e->getMessage());
}