Change OCR Engine 2

Hi, im trying to change the OCR Engine to 2 and I don’t know where to put the ‘OCREngine’ property

try{
$license = time().‘'.$request->file(‘attachment’)->getClientOriginalName();
$licensePath = $request->file(‘attachment’)->move(‘uploads/tickets’,$license);
$returnData=array();
$returnData['disc
’]=$license;
$fileData = fopen($licensePath, ‘r’);
$client = new \GuzzleHttp\Client();
try {
$r = $client->request(‘POST’, ‘https://apipro3.ocr.space/parse/image’,[
‘headers’ => [‘apiKey’ => ‘xxxxxx’],
‘multipart’ => [
[
‘name’ => ‘file’,
‘contents’ => $fileData,
‘OCREngine’ => 2,
]
]
], [‘file’ => $fileData]);
$response = json_decode($r->getBody(),true);
if(!isset($response[‘ErrorMessage’])) {
$parsed_text = explode(“\n”, $response[‘ParsedResults’][0][‘ParsedText’]);
$implode_text = ‘’;
foreach($parsed_text as $index => $string) {
if (strpos($string, ‘kg’) !== FALSE){
$implode_text .= $parsed_text[$index].‘@’;
}
}
$explode = explode(“@”, $implode_text);
return preg_replace(“/[^0-9]/”, “”, $explode[1]);
} else {
return json_encode($response[‘ErrorMessage’]);
}
} catch(Exception $err) {
return json_encode($err->getMessage());
}

    }catch (\Exception $e){
        return json_encode($e->getMessage());
    }

This should work.

If you test the connection with Postman, do you get the same result?

You probably know it, but just in case: Postman is a free Chrome app, see Free OCR API

If you see the problem even with Postman, a screenshot of the result could be helpful.