SubmitOpenClassTask.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. require_once __DIR__.'/../../../vendor/autoload.php';
  3. // 导入对应产品模块的client
  4. use TencentCloud\Tci\V20190318\TciClient;
  5. // 导入要请求接口对应的Request类
  6. use TencentCloud\Tci\V20190318\Models\SubmitOpenClassTaskRequest;
  7. use TencentCloud\Tci\V20190318\Models\SubmitOpenClassTask;
  8. use TencentCloud\Common\Exception\TencentCloudSDKException;
  9. use TencentCloud\Common\Credential;
  10. // 导入可选配置类
  11. use TencentCloud\Common\Profile\ClientProfile;
  12. use TencentCloud\Common\Profile\HttpProfile;
  13. try {
  14. // 实例化一个证书对象,入参需要传入腾讯云账户secretId,secretKey
  15. // 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中。
  16. // 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。
  17. // $cred = new Credential("", "");
  18. $cred = new Credential(getenv("TENCENTCLOUD_SECRET_ID"), getenv("TENCENTCLOUD_SECRET_KEY"));
  19. // 实例化一个http选项,可选的,没有特殊需求可以跳过
  20. $httpProfile = new HttpProfile();
  21. $httpProfile->setReqMethod("POST"); // post请求(默认为post请求)
  22. $httpProfile->setReqTimeout(30); // 请求超时时间,单位为秒(默认60秒)
  23. $httpProfile->setEndpoint("tci.tencentcloudapi.com"); // 指定接入地域域名(默认就近接入)
  24. // 实例化一个client选项,可选的,没有特殊需求可以跳过
  25. $clientProfile = new ClientProfile();
  26. $clientProfile->setSignMethod("TC3-HMAC-SHA256"); // 指定签名算法(默认为HmacSHA256)
  27. $clientProfile->setHttpProfile($httpProfile);
  28. $client = new TciClient($cred, "", $clientProfile);
  29. // 实例化一个ecc实例信息查询请求对象,每个接口都会对应一个request对象。
  30. $req = new SubmitOpenClassTaskRequest();
  31. $req->FileContent="https://edu-test-1253131631.cos.ap-guangzhou.myqcloud.com/aieduautotest/autotest_vedio.mp4";
  32. $req->FileType="vod_url";
  33. $req->LibrarySet=["library_15603955264181591716"];
  34. $resp = $client->SubmitOpenClassTask($req);
  35. // 输出json格式的字符串回包
  36. print_r($resp->toJsonString());
  37. // 也可以取出单个值。
  38. // 你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
  39. }
  40. catch(TencentCloudSDKException $e) {
  41. echo $e;
  42. }