PHP code example of zhan3333 / tencentcloudapi

1. Go to this page and download the library: Download zhan3333/tencentcloudapi 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/ */

    

zhan3333 / tencentcloudapi example snippets


use Zhan3333\Tencent\OCR;
use Zhan3333\Tencent\Request\OCRIdCardRequest;
use Zhan3333\Tencent\Response\OCRIdCardResponse;

$filePath = __DIR__ . '/files/id-card-front.jpg';
$request = new OCRIdCardRequest($filePath, OCRIdCardRequest::SIDE_FRONT);
/** @var OCRIdCardResponse $response */
$response = app(OCR::class)->execute($request);
dump($response);
dump($response->card);
dump($response->error_message);
dump($response->card->id_card_number);