When I try to run the PHP code below, it jutst loads... and loads... and then after about 2 minutes it displays: "Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.". And my server's configured!!! The image I'm attempting to decode: http://dumbsearch.com/dumbocr/qr.png

Here's the code, it's a slightly modified version of the sample code:

  // Enter your data here.
  // You need an Application ID and Application Password,
  // which can be created during registration.
  // If you are not registered yet, register
  // on http://www.abbyyonline.com/en/Account/LogOn?service=ocrsdk.
  // Application ID and Application Password are passed
  // to Cloud OCR server with each request.
  $applicationId = 'dumbsearc';
  $password = '***PASSWORD****';
  $fileName = 'qr.png';

  // 1.a Send an image with barcodes to Cloud OCR server
  //     using processImage call
  //     with barcodeRecognition profile as a parameter,
  //     or
  // 1.b Send an image of a barcode to Cloud OCR server
  //     using processBarcodeField call.
  // 2.  Get response as XML.
  // 3.  Read taskId from XML.

  // Get path to the file that you are going to process.

  // Using the processImage method.
  // Use barcodeRecognition profile to extract barcode values.
  // Save results in XML (you can use any other available output format).
  // See details in API Reference.
  $url = 'http://cloud.ocrsdk.com/processImage?profile=barcodeRecognition&exportFormat=xml';

  // Using the processBarcodeField method.
  // Specify the region of a barcode (by default, the whole image is recognized),
  // barcode type, and other parameters.
  // See details in API Reference.
  // $url = 'http://cloud.ocrsdk.com/processBarcodeField?barcodeType=qrCode';

  // Send HTTP POST request and get XML response.
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_USERPWD, "$applicationId:$password");
  curl_setopt($ch, CURLOPT_POST, 1);
  $post_array = array(
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);
  $response = curl_exec($ch);

  // Parse XML response.
  $xml = simplexml_load_string($response);
  $arr = $xml->task[0]->attributes();

  // Task id.
  $taskid = $arr["id"];

  // 4. Get task information in a loop until task processing finishes.
  // 5. If response contains "Completed" status, extract URL with result.
  // 6. Download recognition result.

  $url = 'http://cloud.ocrsdk.com/getTaskStatus';
  $qry_str = "?taskid=$taskid";

  // Check task status in a loop until it is "Completed".
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url.$qry_str);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "$applicationId:$password");
    $response = curl_exec($ch);

    // Parse XML.
    $xml = simplexml_load_string($response);
    $arr = $xml->task[0]->attributes();
  while($arr["status"] != "Completed");

  // Result is ready. Download it.

  $url = $arr["resultUrl"];
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $response = curl_exec($ch);

  // Parse output XML to extract barcode values.
  // Note that output XML files have different structure
  // depending on the method you used for processing.

Thank you so much!

asked 21 Dec '12, 19:51

dumbproducts's gravatar image


edited 10 Mar, 16:04

Oksana%20Serdyuk's gravatar image

Oksana Serdyuk ♦♦

Which line specifically yields the error message?

(24 Dec '12, 14:26) Dmitry Me ♦♦

No line shows any error, the page keeps loading, and loading, and then finally after about a few minutes, a message apears saying that my apache server is misconfigured, which it isn't.

(24 Dec '12, 23:14) dumbproducts

Is there any output from the sample code? What's the last thing that works and what's the first thing that doesn't work?

(25 Dec '12, 14:52) Dmitry Me ♦♦

It appears to work now. Thanks for your interest.

(12 Jan '13, 02:42) dumbproducts
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 21 Dec '12, 19:51

Seen: 5,685 times

Last updated: 10 Mar, 16:04

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal