PHP code example of nullform / zerobounce-client

1. Go to this page and download the library: Download nullform/zerobounce-client 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/ */

    

nullform / zerobounce-client example snippets


use Nullform\ZeroBounce;

$client = new ZeroBounce\Client($api_key);

try {
    $result = $client->validate($email);
} catch (ZeroBounce\Exceptions\AbstractException $exception) {
    echo $exception->getMessage();
}

// Set PSR-6 or PSR-16 cache instance, TTL (60) and cache keys prefix (zerobounce_)
$client->caching($cache, 60, 'zerobounce_');

$log_func = function (ZeroBounce\Client $client) {
    file_put_contents('zerobounce-client.log', print_r($client->lastResponse(), true));
};

$client = new ZeroBounce\Client($api_key);
$client->logFunction($log_func);

$usage = $client->getUsage('2019-01-01');

$client = new Client($api_key);
$client->timeout(60);
$params = new Params\BulkSendFileParams();
$params->email_address_column = 2;
$file = $client->bulkSendFile($filename, Models\BulkFile::TYPE_VALIDATION, $params);

use Nullform\ZeroBounce\Facade as ZeroBounce;

try {
    $result = ZeroBounce::validate($api_key, $email);
    $credits = ZeroBounce::getCredits($api_key);
} catch (\Exception $exception) {
    $error = $exception->getMessage();
}