PHP code example of bclibraries / libkey-client

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

    

bclibraries / libkey-client example snippets


use BCLib\LibKeyClient\LibKeyClient;

pikey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$libkey_id = 'xxx';
$doi = '10.1371/journal.pone.0193984';

$libkey = LibKeyClient::build($libkey_id, $libkey_apikey);

// Send request.
$http_response = $libkey->request($doi);

// Parse
if ($libkey_response = $libkey->parse($http_response)) {
    echo "Fulltext for {$libkey_response->getTitle()} is at {$libkey_response->getFullTextFile()}\n";
} else {
    echo "Could not find LibKey entry for '$doi'\n";
}

// Fulltext for Differential resilience of Amazonian otters along the Rio Negro in the aftermath of the 20th century
// international fur trade is at https://libkey.io/libraries/431/articles/195287219/full-text-file?utm_source=api_536