<?php
function receiptOcr($imageFile) {
  $receiptOcrEndpoint = 'https://ocr.asprise.com/api/v1/receipt'; //

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $receiptOcrEndpoint);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  curl_setopt($ch, CURLOPT_POSTFIELDS, array(
   'api_key' => 'TEST',      // Use 'TEST' for testing purpose
    'recognizer' => 'auto',     // can be 'US', 'CA', 'JP', 'SG' or 'auto'
    'ref_no' => 'ocr_php_123',  // optional caller provided ref code
    'file' => curl_file_create($imageFile) // the image file
  ));

  $result = curl_exec($ch);
  if(curl_errno($ch)){
      throw new Exception(curl_error($ch));
  }

  echo $result; // result in JSON
}

$file='https://vcrxol.com/orel/imgi/2020106564_52531.png';

print("=== Java Receipt OCR ===\n");
// receiptOcr('US-1.jpg'); // Modify it to use your own file
// $result=receiptOcr($file); 
// $result=json_decode($result);

// $result=str_replace(",","<br>,",$result);


echo '====================>'.$result;

$file='../orel/imgi/2020106564_52531.png';

echo '<br>';
echo '<br>';
echo 'C : '.date('Y-m-d H:i:s',filectime($file));
echo '<br>';
echo '<br>';
echo 'M : '.date('Y-m-d H:i:s',filemtime($file));
echo '<br>';
echo '<br>';
echo '<br>';

$stat=stat($file);

var_dump2($stat);
echo '<br>';
echo ' : '.date('Y-m-d H:i:s',$stat['atime']);
echo '<br>';
echo '<br>';
echo ' : '.date('Y-m-d H:i:s',$stat['mtime']);
echo '<br>';
echo '<br>';
echo ' : '.date('Y-m-d H:i:s',$stat['ctime']);
echo '<br>';



?>