コード例 #1
0
    }
    print "\n\n";
    $edit_iri = $testdr->sac_edit_iri;
    $cont_iri = $testdr->sac_content_src;
    $edit_media = $testdr->sac_edit_media_iri;
    $statement_atom = $testdr->sac_state_iri_atom;
    $statement_ore = $testdr->sac_state_iri_ore;
}
if (false) {
    print "About to request Atom serialisation of the deposit statement from " . $statement_atom . "\n";
    if (empty($testuser)) {
        print "As: anonymous\n";
    } else {
        print "As: " . $testuser . "\n";
    }
    $testatomstatement = $testsac->retrieveAtomStatement($statement_atom, $testuser, $testpw, $testobo);
    if ($testatomstatement->sac_status >= 200 || $testatomstatement->sac_status < 300) {
        $testatomstatement->toString();
    }
    print "\n\n";
}
if (false) {
    print "About to request OAI-ORE serialisation of the deposit statement from " . $statement_ore . "\n";
    if (empty($testuser)) {
        print "As: anonymous\n";
    } else {
        print "As: " . $testuser . "\n";
    }
    $testoaiore = $testsac->retrieveOAIOREStatement($statement_ore, $testuser, $testpw, $testobo);
    echo $testoaiore;
    print "\n\n";
コード例 #2
0
print "Edit IRI: " . $edit_iri . "\n";
print "Edit Media: " . $edit_media . "\n";
print "Statement: " . $statement_atom;
print "\n\n";
// Add the DIP content
print "About to add file (" . $contentzip . ") to " . $edit_media . "\n";
$response = $sword->addExtraFileToMediaResource($edit_media, $user, $password, '', $contentzip, "application/zip", false);
print "Received HTTP status code: " . $response->sac_status . " (" . $response->sac_statusmessage . ")\n";
print "\n\n";
// Complete the deposit
print "About to complete the deposit at " . $edit_iri . "\n";
$response = $sword->completeIncompleteDeposit($edit_iri, $user, $password, '');
print "Received HTTP status code: " . $response->sac_status . " (" . $response->sac_statusmessage . ")\n";
// Fetch the statement
print "About to request Atom serialisation of the deposit statement from " . $statement_atom . "\n";
$atomstatement = @$sword->retrieveAtomStatement($statement_atom, $user, $password, '');
if ($atomstatement->sac_status >= 200 || $atomstatement->sac_status < 300) {
    $atomstatement->toString();
}
print "\n\n";
$handle = $atomstatement->sac_entries[1]->sac_content_source[0];
$handle = substr($handle, strpos($handle, 'bitstream/') + 10);
$handle = substr($handle, 0, strpos($handle, '/', strpos($handle, '/') + 1));
print "Handle of new object is: " . $handle;
print "\n\n";
// Login to DSpace REST interface
$data = array("email" => $user, "password" => $password);
$data_string = json_encode($data);
// https://groups.google.com/forum/m/#!topic/dspace-tech/s7SQGhgDUPI
$url = $dspacerest . '/login';
$curl = curl_init($url);