Hi all,

I'm trying to integrate ABBYY OCR into ZF 1.12 website, but I get an error Page Not Found despite processImage response 200. Following the code: // Get path to file that we are going to recognize $local_directory=realpath(APPLICATION_PATH . '/../public/img/screens'); $filePath = $local_directory.'/'.$fileName; if(!file_exists($filePath)) { die('File '.$filePath.' not found.'); }

    // Recognizing with English language to rtf
    // You can use combination of languages like ?language=english,russian or
    // ?language=english,french,dutch
    // For details, see API reference for processImage method
    $url = 'http://cloud.ocrsdk.com/processImage?language=english&exportFormat=rtf';

    $adapter = new Zend_Http_Client_Adapter_Curl();
    $adapter->setConfig(array(
        'curloptions' => array(
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_HTTPAUTH       => CURLAUTH_DIGEST,
            CURLOPT_USERPWD        => "$applicationId:$password"
        )
    ));
    $client = new Zend_Http_Client();
    $client->setUri($url);
    $client->setCookieJar();
    $client->setAdapter($adapter);
    $response = $client->request();

    var_dump($response); die();

I've got the following response:

object(Zend_Http_Response)[64]

protected 'version' => string '1.1' (length=3) protected 'code' => int 200 protected 'message' => string 'OK' (length=2) protected 'headers' => array (size=6) 'Cache-control' => string 'private' (length=7) 'Content-type' => string 'text/html; charset=utf-8' (length=24) 'X-thumbs-up' => string 'Thumbs up for looking this deep!' (length=32) 'Date' => string 'Tue, 15 Jan 2013 14:01:16 GMT' (length=29) 'Connection' => string 'close' (length=5) 'Content-length' => string '3153' (length=4) protected 'body' => string '

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="ctl00_Head1">

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>

Page Not Found
  • ABBYY Cloud OCR SDK

</title><link href="/Content/OcrSdk.css" rel="stylesheet" type="text/css"/>

'... (length=3153)

asked 15 Jan '13, 21:00

Demonil's gravatar image

Demonil
112


The problem is that you're trying to do a GET request but processImage only supports POST requests. You have to modify your code so that it makes a POST request.

link

answered 16 Jan '13, 11:35

Dmitry%20Me's gravatar image

Dmitry Me ♦♦
2387

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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

Tags:

×2
×2
×2

Asked: 15 Jan '13, 21:00

Seen: 1,179 times

Last updated: 16 Jan '13, 11:35

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