Text overlay is not provided as it is not requested

Hello,

I am using the free OCR api to get text from image. I managed to echo the ParsedText but I want to echo individual line. For that I set the request like this:

$r = $client->request('POST', 'https://api.ocr.space/parse/image',[
        'headers' => ['apikey' => '3cefc5cd9788957'
		              
		              ],
				  
        'multipart' => [
            [
			    'OCREngine' => '2',
				'isOverlayRequired'=>'true',
                'name' => 'file',
                'contents' => $fileData
            ]
        ]
    ], ['file' => $fileData]);

If I echo Parsedtext the text is ok but if I try to echo:

foreach($response['ParsedResults'] as $key)
{
         echo $key['TextOverlay']['Message'];
}

The error mesagge is: Text overlay is not provided as it is not requested. Am I doing something wrong or not sending ‘isOverlayRequired’=>‘true’ ok? or in the right place?

Thanks.

Hi, I’m testing with the free OCR API and I have the same problem.

Isn’t this active in the free version?

Best regards,
Chris Andries

Hi,

Meanwhile I found the cause. I added it to the headers instead of the body!

Now everything works as expected.

Best regards,
Chris Andries