<?php ini_set("max_execution_time", 30000); require dirname(__FILE__) . "/../vendor/autoload.php"; require dirname(__FILE__) . "/../Psr4AutoloaderClass.php"; $LRConfig = new LearningRegistry\LearningRegistryConfig(array("url" => "sandbox.learningregistry.org", "username" => "*****@*****.**", "https" => 1, "signing" => 1, "password" => "", "passphrase" => "", "oauthSignature" => "", "auth" => "basic", "keyPath" => "", "publicKeyPath" => "")); // Create a new service (publish means we want to publish) $LR = new LearningRegistry\LearningRegistryServices\LearningRegistryUpdate($LRConfig); $LRDocument = new LearningRegistry\LearningRegistryDocuments\LearningRegistryDCMetadata($LR); $LRDocument->create(); $LRDocument->setIdFields(array('curator' => "*****@*****.**", 'owner' => "*****@*****.**", 'signer' => "*****@*****.**", 'submitter_type' => "user", 'submitter' => "*****@*****.**")); $LRDocument->setSigFields(array('signature' => "", 'key_server' => "", 'key_location' => "", 'key_owner' => "", 'signing_method' => "")); $LRDocument->setResFields(array('resource_locator' => "www.wibble.com", 'keys' => array("boo", "hoo"), 'replaces' => 'c1281806619c4ee488f755bd89ee4aa5', 'resource_data' => htmlspecialchars_decode("DATA!!!!!"))); // Turn the arrays above into a document $LR->createDocument(); $LR->signDocument(); // Verify the document is ok (optional) if ($LR->verifyDocument()) { // make the document into LR format and ready $LR->finaliseDocument(); // send the document $LR->UpdateService(); echo "the response code is " . $LR->getStatusCode() . "<br />"; echo "the OK is " . $LR->getOK() . "<br />"; print_r($LR->getResponse()); if ($LR->getOK() != "1") { echo "the Error is " . $LR->getError() . "<br />"; } else { echo "the doc ID is " . $LR->getDocID() . "<br />"; } }
<?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" => 1, "password" => "", "passphrase" => "", "oauthSignature" => "", "auth" => "basic", "keyPath" => "", "publicKeyPath" => "")); $LR = new LearningRegistry\LearningRegistryServices\LearningRegistryUpdate($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())); $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, and I am some moresdsdsdsdsd"), 'replaces' => array("74e40160c45847e494e93813c01e7ff1"))); $LR->createDocument(); $LR->signDocument(); if ($LR->verifyUpdatedDocument()) { echo "here"; $LR->finaliseDocument(); $LR->UpdateService(); echo "New ID is " . $LR->getResponse(); } } else { print_r($LR->getResponse()); } } else { print_r($LR->getResponse()); }