Place the contents of the /library folder where you keep your library files. It includes the Zend_Json classes to allow JSON object decoding/encoding when using PHP version below 5.2 (which introduced the json_encode()
/ json_decode()
functions).
If you already use the Zend Framework, you can remove the /Zend folder and just put BinpressAPI.php class in your library folder.
Usage is simple and every use-case is shown in the examples. Include the class, instance a BinpressAPI object and call the API method you want to use.
Example fetching component listing:
<?php
require_once('/library/BinpressAPI.php');
$api = new BinpressAPI();
$components = $api -> getList(array(
'language' => 'php',
'limit' => 5,
'page' => 2
));
For authenticated requests (publisher data), you need to put your API secret and key in the appropriately named class members $_secret
and $_key
. You can find API access credentials in your publisher account.
For more information on the various parameters each API method uses, visit the API reference.