PHP code example of guijianshi / baidu-ocr

1. Go to this page and download the library: Download guijianshi/baidu-ocr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

guijianshi / baidu-ocr example snippets


//本地图片识别
$client = new baidu\ocr\AipOcr(APP_ID, API_KEY, SECRET_KEY);
$image = file_get_contents(__DIR__ . '/test.png'); // 图片地址 (远程地址https可用这个)
$result = $client->basicGeneral($image);