1. Go to this page and download the library: Download fbng/netgalley-api-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/ */
fbng / netgalley-api-client example snippets
use NetGalley\API\Client;
// obtain your credentials from NetGalley
$myUser = 'example';
$myApiKey = 'KEY';
$myApiSecret = 'SECRET';
// if set to true, the client will target a staging server
$testMode = true;
// instantiate the client using your credentials
$client = new Client($myUser, $myApiKey, $myApiSecret, $testMode);
// make an API request; see the relevant documentation
// for details of the API you are requesting; here we
// are creating a new widget for a customer
$response = $client->makeRequest('/private/widgets', 'POST', array(
'email' => '[email protected]',
'isbn' => '1234567890123',
'market' => 'US',
'temporaryDrm' => false,
'firstName' => 'Some',
'lastName' => 'Customer'
));
// the response will be a JSON-encoded string, so decode it
$response = json_decode($response, true);
// do something with the response
echo 'Response was: ' . print_r($response, true) . PHP_EOL;
use NetGalley\API\OauthClient;
// obtain your credentials from NetGalley
$clientId = 'CLIENTID';
$clientSecret = 'SECRET';
// if requesting a token to grant third-party access, set the authorization
// code captured by the redirect URI
//
// NOTE: the NetGalley API does not currently support authorizing third-party
// access - this is internally for subsequent requests)
$client->requestToken();
// make requests and handle responses the same as above
$response = null;
$responseFile = $client->makeFileRequest('/private/reports/example_report', 'GET', array('filter' => 'example'));
if ($responseFile !== false) {
// Do something with $responseFile
fclose($responseFile);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.