WokerTask/vendor/tencentcloud/tencentcloud-sdk-php/examples/hcm/v20181106/hcm_ocr.php

52 lines
101 KiB
PHP
Raw Normal View History

2023-12-27 14:06:33 +08:00
<?php
require_once __DIR__.'/../../../vendor/autoload.php';
// 导入对应产品模块的client
use TencentCloud\Hcm\V20181106\HcmClient;
// 导入要请求接口对应的Request类
use TencentCloud\Hcm\V20181106\Models\EvaluationRequest;
use TencentCloud\Hcm\V20181106\Models\EvaluationResponse;
use TencentCloud\Common\Exception\TencentCloudSDKException;
use TencentCloud\Common\Credential;
// 导入可选配置类
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
try {
// 实例化一个证书对象入参需要传入腾讯云账户secretIdsecretKey
// 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中。
// 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。
//$cred = new Credential("", "");
$cred = new Credential(getenv("TENCENTCLOUD_SECRET_ID"), getenv("TENCENTCLOUD_SECRET_KEY"));
// 实例化一个http选项可选的没有特殊需求可以跳过
$httpProfile = new HttpProfile();
$httpProfile->setReqMethod("POST"); // post请求(默认为post请求)
$httpProfile->setReqTimeout(30); // 请求超时时间,单位为秒(默认60秒)
$httpProfile->setEndpoint("hcm.ap-shanghai.tencentcloudapi.com"); // 指定接入地域域名(默认就近接入)
// 实例化一个client选项可选的没有特殊需求可以跳过
$clientProfile = new ClientProfile();
$clientProfile->setSignMethod("HmacSHA256"); // 指定签名算法(默认为HmacSHA256)
$clientProfile->setHttpProfile($httpProfile);
$client = new HcmClient($cred, "ap-shanghai", $clientProfile);
$req = new EvaluationRequest();
$req->SessionId="stress_test_956938";
$req->Image = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAA4JCgwKCQ4MCwwPDw4QFSIWFRMTFSoeIBkiMiw0NDEsMC83Pk9DNzpLOy8wRV5GS1JUWVlZNUJhaGBWZ09XWVX/2wBDAQ8PDxUSFSgWFihVOTA5VVVVVVVVVVVV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UAJRilooCwCpUNRinrQArioiKkY1GaACkpaKAEopaKAEooooEFJS0lAwooooAM0uaSigBaKSigAopDRQAtBopM0AFAoooAXNFJilxSAKKTFKKAFooooAKWkpaAGmqOsjNjJ7c1eNVdUGbKX6UnsVE480UHrRWBsaSxipAoFM3UoeuQ3JKMimb6TrQBLxSbhUZzjrTeaAJjz3pOR3pEzTwKABVJpwj560qjFOFIQpi4600RU7dRmgBygYrbs/+PdPpWJu4rasubdPpXRh/iMquxOab3pxpveuw5xaKKKYgooooAXNGaSigBc0ZpKKAHUUUUAFFGaM0AFFJmlzQAtLTc0tADqKTNGaBC0UmaM0ALRRRQAUUUZoAKKM0ZoAKKM0ZoAKKM0ZoAKKM0ZoAKKM0ZoAKKTNFABRRRQAlFFFACUUUUAFFFFAC0UmaM0ALSUZpDQAZozTaKAHZozTaM0ALmjNNzRQA7NGabQTigB1FM3D1o3D1oAfRTNw9aNw9aAHUoNR7qUMKAJQaWo93vRu96AH0UzzU/vCmGZP7woFzIlpDUXnJ/eFBmT+9QHMiWiofPT1pPPT1oHz
$resp = $client->Evaluation($req);
// 输出json格式的字符串回包
print_r($resp->toJsonString());
// 也可以取出单个值。
// 你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
// print_r($resp->TotalCount);
}
catch(TencentCloudSDKException $e) {
echo $e;
}