PHP SDK for the RBLTracker REST API

We’re excited to announce the release of the RBLTracker PHP SDK- a PHP wrapper library that developers can use to integrate the RBLTracker API into their existing processes. This wrapper gives developers access to all the functionality of the RBLTracker API, in a simple, easy to install library.

Installation

The PHP SDK can be easily installed via composer:

composer require rbltracker/sdk

Or if you prefer, you can download the source code, or clone the repository, from the github page: https://github.com/rbltracker/rbltracker-php

API Access Token

To use the PHP SDK, you must access the Account SID and Access Token, available from the Account -> API Access section of the RBLTracker Portal.

api_access_token_sid

Example Usage

Using the PHP SDK only requires a couple lines of PHP code.

In this example, we’ll request a full list of all the hosts on our account:

<?php

$client = new RBLTracker\Client(<Account SID>, <Access Token>);
try
{
    $hosts = $client->hosts->get(array('page_size' => 5, 'page' => 2));

    print_r($hosts);

} catch(RBLTracker\Exceptions\RBLTrackerException $e)
{
    echo $e->getMessage();
}

?>

 

Which will output a PHP array that looks like:

Array
(
    [status_code] => 200
    [status_message] => Ok
    [total_hosts] => 8
    [total_listed] => 0
    [page] => 2
    [total_pages] => 2
    [page_size] => 5
    [data] => Array
        (
            [0] => Array
                (
                    [id] => HTa370ecd34e7d9eb124d1b3617afafaf8
                    [host] => fonolo.com
                    [name] => Fonolo
                    [type] => uribl
                    [parent] => 
                    [status] => active
                    [last_checked] => 2016-07-20 09:02:18 EDT 
                    [first_listed] => 
                    [listed_period] => 
                    [listed] => 0
                    [listed_count] => 0
                    [listed_details] => Array
                        (
                        )

                )

            [1] => Array
                (
                    [id] => HTf4e4796f608db1e3edf95c4bc19b3fc9
                    [host] => mrhost.ca
                    [name] => Mr.Host Website
                    [type] => uribl
                    [parent] => 
                    [status] => active
                    [last_checked] => 2016-07-20 09:00:59 EDT
                    [first_listed] => 
                    [listed_period] => 
                    [listed] => 0
                    [listed_count] => 0
                    [listed_details] => Array
                        (
                        )

                )

            [2] => Array
                (
                    [id] => HTbd7fe63ba673506575158fdd7a7d33b9
                    [host] => rbltracker.com
                    [name] => RBLTracker Site
                    [type] => uribl
                    [parent] => 
                    [status] => active
                    [last_checked] => 2016-07-20 09:01:23 EDT
                    [first_listed] => 
                    [listed_period] => 
                    [listed] => 0
                    [listed_count] => 0
                    [listed_details] => Array
                        (
                        )

                )

        )

    [version] => 3.4
)

 

In this example, we’ll pause a contact on our account, which will temporary stop notifications to the contact:

<?php

$client = new RBLTracker\Client(<Account SID>, <Access Token>);
try
{
    $res = $client->contact->pause('CO123456789');

    print_r($res);

} catch(RBLTracker\Exceptions\RBLTrackerException $e)
{
    echo $e->getMessage();
}

?>

 

On success, this will return:

Array
(
    [status_code] => 200
    [status_message] => Contact paused successfully.
    [version] => 3.2
)

 

See our API reference site for a complete list of all of the PHP SDK features.

Free Registration

Sign up now and try blacklist monitoring for free!

Sign Up Now