コード例 #1
0
ファイル: APITest.php プロジェクト: unikent/lib-php-kar
 /**
  * Test we can pull by ID.
  */
 public function testPullID()
 {
     $api = new \unikent\KAR\API();
     $documents = $api->search_by_id(4);
     $this->assertEquals(1, count($documents));
     $document = reset($documents);
     $this->assertEquals(4, $document->get_id());
 }
コード例 #2
0
ファイル: run.php プロジェクト: unikent/lib-php-kar
<?php

/**
 * KAR API for is-dev applications.
 *
 * @copyright  2014 Skylar Kelty <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../vendor/autoload.php';
if (!isset($argv[1])) {
    die("Usage: php run.php <author email>\n");
}
$api = new \unikent\KAR\API();
$documents = $api->search_by_email($argv[1]);
foreach ($documents as $document) {
    echo '--------------------------------- <br/>';
    $formats = array('apa', 'harvard-university-of-kent', 'ieee-with-url', 'chicago-author-date');
    foreach ($formats as $format) {
        echo '<strong>' . $format . '</strong><br/>' . $document->as_citation($format);
    }
}
コード例 #3
0
ファイル: run.php プロジェクト: unikent/lib-php-kar
<?php

/**
 * KAR API for is-dev applications.
 *
 * @copyright  2014 Skylar Kelty <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../vendor/autoload.php';
if (!isset($argv[1])) {
    die("Usage: php run.php <eprintid>\n");
}
$api = new \unikent\KAR\API();
$documents = $api->search_by_id($argv[1]);
foreach ($documents as $document) {
    echo "---------------------------------\n";
    echo $document . "\n";
}