<?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" => "")); $LR = new LearningRegistry\LearningRegistryServices\LearningRegistryUpdate($LRConfig); $LRDocument = new LearningRegistry\LearningRegistryDocuments\LearningRegistryReplaceDocument(array("sandbox.learningregistry.org", "8bc07b5153cd4551af8705403b84bdd8", $LR)); $LRDocument->emptyDocument($LR); $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"), 'resource_data' => htmlspecialchars_decode("DATA!!!!!"))); $LRDocument->setResFields(array('replaces' => array("8bc07b5153cd4551af8705403b84bdd8"))); // Turn the arrays above into a document $LR->createDocument(); $LR->signDocument(); // Verify the document is ok (optional) if ($LR->verifyUpdatedDocument()) { // 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 />"; } }