<?php

require dirname(__FILE__) . "/../vendor/autoload.php";
require dirname(__FILE__) . "/../Psr4AutoloaderClass.php";
$LRConfig = new LearningRegistry\LearningRegistryConfig(array("url" => "sandbox.learningregistry.org", "username" => "*****@*****.**", "https" => 1, "signing" => 0, "password" => "", "oauthSignature" => "", "auth" => "oauth", "keyPath" => "c:/users/Pat/AppData/Roaming/gnupg/pubring.gpg", "publicKeyPath" => "http://www.pgogywebstuff.com/public_key.txt"));
$LR = new LearningRegistry\LearningRegistryServices\LearningRegistryPublish($LRConfig);
if ($LR->checkNode()) {
    if ($LR->checkNodeActive()) {
        $LR->setIdFields(array('curator' => "*****@*****.**", 'owner' => "*****@*****.**", 'signer' => "*****@*****.**", 'submitter_type' => "user", 'submitter' => "*****@*****.**"));
        $LR->setResFields(array('resource_locator' => "www.wibble.com", 'resource_data_type' => 'metadata', 'active' => true, 'submitter_timestamp' => "", 'submitter_TTL' => "", 'resource_TTL' => "", 'payload_schema_locator' => "", 'payload_schema_format' => "", 'doc_type' => 'resource_data', 'doc_version' => '0.49.0', 'payload_placement' => 'inline', 'payload_schema' => array('DC 1.1'), 'keys' => array("hello")));
        $LR->setSigFields(array('signature' => "", 'key_server' => "", 'key_location' => "", 'key_owner' => "", 'signing_method' => ""));
        $LR->setTosFields(array('submission_TOS' => "Standard"));
        $LR->setResFields(array('resource_data' => htmlspecialchars_decode("I am some data")));
        $LR->createDocument();
        if ($LR->verifyDocument()) {
            $LR->finaliseDocument();
            $LR->PublishService();
            $response = $LR->getDocData();
            print_r(json_decode($response->response));
        }
    } else {
        print_r($LR->getResponse());
    }
} else {
    print_r($LR->getResponse());
}
Beispiel #2
0
<?php

require dirname(__FILE__) . "/../vendor/autoload.php";
require dirname(__FILE__) . "/../Psr4AutoloaderClass.php";
$LRConfig = new LearningRegistry\LearningRegistryConfig('./test_config.txt');
// Create a new service (publish means we want to publish)
$LR = new LearningRegistry\LearningRegistryServices\LearningRegistryPublish($LRConfig);
// Check the node exists (optional)
//if($LR->checkNode()){
// Check the node is active (optional)
//if($LR->checkNodeActive()){
// Set the id fields - can be done one parameter at a time
// Identity fields MUST match original or the Delete/Replace will fail.
$LR->setIdFields(array('owner' => "Joe Hobson", 'submitter_type' => "user", 'submitter' => "barry white <*****@*****.**>"));
// Set the resource fields - can be done one parameter at a time
$LR->setResFields(array('replaces' => array('622e42a22dc34f19adef825c55628495'), 'resource_data_type' => 'metadata', 'active' => true, 'doc_type' => 'resource_data', 'doc_version' => '0.49.0', 'payload_placement' => 'none', 'payload_schema' => array('DC 1.1'), 'resource_data' => ''));
$LR->setTosFields(array('submission_TOS' => "http://learningregistry.org/tos"));
// Turn the arrays above into a document
$LR->createDocument();
// Verify the document is ok (optional)
if ($LR->verifyDocument()) {
    // make the document into LR format and ready
    $LR->finaliseDocument();
    // send the document
    $LR->PublishService();
    print_r($LR->getResponse());
}
//  }
//}