Skip to content

tytymnty/megvii-ocr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

MegviiOCR

Megvii OCR PHP SDK

How to


require_once 'MegviiOCR.php';

use MegviiOCR\MegviiOCR;

$megviiOCR = new MegviiOCR('{YOUR_API_KEY}', '{YOUR_API_SECRET}');

// Detect by local file
$resp = $megviiOCR->execute('ocrvehiclelicense', ['image_file' => '{YOUR_IMAGE_FILE_PATH}']);

// Detect by url
// $resp = $megviiOCR->execute('ocrvehiclelicense', ['image_url' => '{IMAGE_URL}']);

If Detect success, return:


Array
(
  [http_code] => 200
  [request_url] => https://api.megvii.com/cardpp/v1/ocrvehiclelicense
  [body] => {...} // JSON String
)

If fail:


Array
(
  [http_code] => 404
  [request_url] => https://api.megvii.com/cardpp/v1/ocrvehiclelicense1
  [body] => {"error_message": "API_NOT_FOUND"}  // JSON String
)