PHP code example of bananatag / bananatag-api-php

1. Go to this page and download the library: Download bananatag/bananatag-api-php 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/ */

    

bananatag / bananatag-api-php example snippets




    use Bananatag\Api;
    
    // Create Api class instance
    $btag = new Api('AuthID', 'Access Key');
	
    // Make request for all tags in date range
	$results = $btag->request("tags", ['start'=>'2015-01-01', 'end'=>'2015-02-01']);
	
    // Print list of tags
    echo "Total Tags: " . count($results['data']) . "<br><hr><br>";
    
    print_r($results['data']);
    


$btag = new Api('AuthID', 'Access Key');

function getTags(&$btag) {
    $results = $btag->request("tags", []);

    echo $results['paging']['cursors']['next'];

    if ($results['paging']['cursors']['next'] < $results['paging']['cursors']['total']) {
        sleep(1.2);
        getTags($btag);
    }
}

getTags($btag);


// Page 1
$results = $btag->request("tags", []);
// Page 2
$results = $btag->request("tags", []);
// Page 3, etc
$results = $btag->request("tags", []);


// Page 1
$results = $btag->request("tags", ['page'=>1]);
// Page 3
$results = $btag->request("tags", ['page'=>3]);
// Page 2
$results = $btag->request("tags", ['page'=>2]);
json
""bananatag/bananatag-api-php": "dev-master"
}