How do I use OCREngine 2 in Php?
I tried to change the engine by adding the parameter “OCREngine 2” as it says here:
Post OCREngine
but it didn’t work because the result is the same as when using engine 1 on the same image in ocr.space
function uploadToApi($target_file){
require __DIR__ . '/vendor/autoload.php';
$fileData = fopen($target_file, 'r');
$client = new \GuzzleHttp\Client();
try {
$r = $client->request('POST', 'https://api.ocr.space/parse/image',[
'headers' => [
'apiKey' => 'my_key',
'language' => 'por',
'OCREngine' => 2
],
'multipart' => [
[
'name' => 'file',
'contents' => $fileData
]
]
], ['file' => $fileData]);
$response = json_decode($r->getBody(),true);
if($response['ErrorMessage'] == "") {
...