As per stated in the processFields API info: "The XML file with the parameters of processing is transmitted in the request body".

In PHP, the file to be processed is transmitted in the request body as follows:

$post_array = array( "my_file"=>"@".$filePath, ); curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $post_array);

How should I include the processing parameters XML file into the request body? What should the file be named in the post_array?

Thanks, Adam

asked 21 Jun '12, 01:03

greatrat00's gravatar image


my_file is just a key for the array, it can really be any string. The filepath is encoded by "@".$filePath which is literal @ prepending the file path.

processFields accepts three parameters as described in the documentation. Two parameters - task id and description - go in the URL and the third one is the XML you're asking about. Since you don't submit anything else the XML file is the only file being submitted. So you can just set $filePath to contain the path to the XML file and use the same code as in your question:

$post_array = array( "my_file"=>"@".$filePath, );
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $post_array);

answered 21 Jun '12, 12:28

Dmitry%20Me's gravatar image

Dmitry Me ♦♦

edited 21 Jun '12, 18:25

Dmitry, thanks for your answer.

I'm currently using the filePath to send the pdf file that I'm doing OCR on. How do I send that file if the array will now be filled with the processing parameter XML file?

Thanks again!

(21 Jun '12, 18:38) greatrat00

@greatrat00: First you set filePath to the PDF file, construct the POST parameters array and use submitImage to send the pdf file. You will now have the "task id". Then you set filePath to the settings XML file, again construct the POST parameters array and use processFields which will trigger actual processing.

(22 Jun '12, 10:49) Dmitry Me ♦♦

And how do I include the processing parameter xml file in the request body? Do I include it in the array as well?


answered 21 Jun '12, 17:22

greatrat00's gravatar image


I updated my answer. Questions like this one are better asked as comments to the unclear answer.

(21 Jun '12, 18:25) Dmitry Me ♦♦

What if I needed to submit it as a URL from PHP with the post raw data can I do that?


answered 17 Aug '12, 08:19

ronaktal's gravatar image


You've asked that as a separate question http://forum.ocrsdk.com/questions/343/ocr-url and that question will be answered when you provide enough details to that question.

(17 Aug '12, 11:38) Dmitry Me ♦♦
Your answer
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 Jun '12, 01:03

Seen: 4,338 times

Last updated: 17 Aug '12, 11:38

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