< ? php require_once 'vendor/autoload.php';
use TencentCloud\\ Common\\ Credential;
use TencentCloud\\ Common\\ Profile\\ ClientProfile;
use TencentCloud\\ Common\\ Profile\\ HttpProfile;
use TencentCloud\\ Common\\ Exception\\ TencentCloudSDKException;
use TencentCloud\\ Tms\\ V20201229\\ TmsClient;
use TencentCloud\\ Tms\\ V20201229\\ Models\\ TextModerationRequest;
try {
$cred = new Credential("SecretId", "SecretKey");
$httpProfile = new HttpProfile();
$httpProfile - > setEndpoint("tms.tencentcloudapi.com");
$clientProfile = new ClientProfile();
$clientProfile - > setHttpProfile($httpProfile);
$client = new TmsClient($cred, "ap-guangzhou", $clientProfile);
$req = new TextModerationRequest();
$params = array();
$req - > fromJsonString(json_encode($params));
$resp = $client - > TextModeration($req);
print_r($resp - > toJsonString());
} catch (TencentCloudSDKException $e) {
echo $e;
}
Was this page helpful?