This is my code:
$basePath = "https://api.aspose.cloud/v1.1";
$remFolder = "omrapi";
$templateFile = "source/template.txt";
$templateImage = "template.png";
$answerFile = "answersheet.jpg";
include "config.php";
//Upload template file to dropbox
$storage = new Storage($appKey, $appSid, $basePath);
if(!$storage->isFolderExist($remFolder)){
$storage->createFolder($remFolder);
}
$storage->uploadFile("./response/".$templateImage, $remFolder."/".$templateImage);
$omr = new OmrApi($appKey, $appSid);
//Generate sheet from dropbox
try {
//$response = $omr->postRunOmrTask($filename, "RecognizeImage", null, "XStore", $remFolder);
$corrResponse = $omr->postRunOmrTask($templateImage, "CorrectTemplate", null, "XStore", $remFolder);
echo "<pre>";
print_r($corrResponse);
echo "</pre>";
$templateId = $corrResponse->getPayload()->getResult()->getTemplateId();
echo "<h1>";
echo $templateId;
exit();
$param = new AsposeOmr\Model\OMRFunctionParam();
$param->setFunctionParam($templateId);
$response = $omr->postRunOmrTask($answerFile, "RecognizeImage", $param, "XStore", $remFolder);
} catch (Exception $exc) {
echo $exc->getMessage();
exit();
}
$responseObj = (object)$response;
if ($responseObj->getStatus() != "OK"){
throw new \Exception("Request failed {$text} : " . $responseObj->getStatus());
}
file_put_contents(time().".answer.txt", $response);
echo "Done";
I am getting the following error:
Request processing caused an exception. Check files uploaded correctly and try again. Template template does not exists. Error reference ID 5c66c581-74c9-4d5d-9d0c-291192a0721c
I tried your demo. It worked but its code is piece of puzzle. Even for loading a simple configuration file too much code has been written on it. One function is calling second, second calling third and third is calling fourth, only to load configuration file. This is very confusing. I am not able to reuse the code of demo. How ever I tried myself to write some code but unfortunately getting the above error.
Can you please explain how can I fix it.