├── .github └── workflows │ ├── format.yml │ └── install.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── composer.json ├── sample ├── CreateDataset.php ├── CreateDatasetBinding.php ├── CreateFileMetaIndex.php ├── CreateWatermarkTemplateDemo.php ├── DatasetFaceSearch.php ├── DatasetSimpleQuery.php ├── DeleteDataset.php ├── DeleteDatasetBinding.php ├── DeleteFileMetaIndex.php ├── DescribeDataset.php ├── DescribeDatasetBinding.php ├── DescribeDatasetBindings.php ├── DescribeDatasets.php ├── DescribeFileMetaIndex.php ├── GeneratePlayListDemo.php ├── GetHLSPlayKeyDemo.php ├── GetHLSTokenDemo.php ├── ImageSearch.php ├── ImageSearchAdd.php ├── ImageSearchDelete.php ├── ImageSearchOpen.php ├── ImageSlim.php ├── PostWatermarkJobsDemo.php ├── SearchImage.php ├── UpdateDataset.php ├── UpdateFileMetaIndex.php ├── ZipFilePreviewDemo.php ├── aIBodyRecognitionProcess.php ├── aIGameRecProcess.php ├── aIImageColoringProcess.php ├── aIImageCropProcess.php ├── aIImageEnhanceProcess.php ├── aIImageSuperResolutionProcess.php ├── aILicenseRecProcess.php ├── abortMultipartUpload.php ├── addHotLink.php ├── appendObject.php ├── autoTranslationBlockProcess.php ├── bindCiService.php ├── blindWatermark.php ├── cancelInventoryTriggerJob.php ├── cancelLiveVideoAuditing.php ├── catchException.php ├── ciTransformation.php ├── closeAiService.php ├── closeAsrService.php ├── closeImageSlim.php ├── closeOriginProtect.php ├── completeMultipartUpload.php ├── copy.php ├── copyObject.php ├── cosClient.php ├── createAiTranslationJobs.php ├── createAiWordsGeneralizeJobs.php ├── createBucket.php ├── createDocProcessJobs.php ├── createFileCompressJobs.php ├── createFileHashCodeJobs.php ├── createFileUncompressJobs.php ├── createFolder.php ├── createInventoryTriggerJob.php ├── createM3U8PlayListJobs.php ├── createMediaAnimationJobs.php ├── createMediaAnimationTemplate.php ├── createMediaConcatJobs.php ├── createMediaConcatTemplate.php ├── createMediaDigitalWatermarkJobs.php ├── createMediaExtractDigitalWatermarkJobs.php ├── createMediaHighSpeedHdTemplate.php ├── createMediaJobs.php ├── createMediaNoiseReductionJobs.php ├── createMediaNoiseReductionTemplate.php ├── createMediaPicProcessJobs.php ├── createMediaPicProcessTemplate.php ├── createMediaQualityEstimateJobs.php ├── createMediaSDRtoHDRJobs.php ├── createMediaSegmentJobs.php ├── createMediaSegmentVideoBodyJobs.php ├── createMediaSmartCoverJobs.php ├── createMediaSmartCoverTemplate.php ├── createMediaSnapshotJobs.php ├── createMediaSnapshotTemplate.php ├── createMediaStreamExtractJobs.php ├── createMediaSuperResolutionJobs.php ├── createMediaSuperResolutionTemplate.php ├── createMediaTargetRecJobs.php ├── createMediaTargetRecTemplate.php ├── createMediaTranscodeJobs.php ├── createMediaTranscodeProTemplate.php ├── createMediaTranscodeTemplate.php ├── createMediaVideoEnhanceJobs.php ├── createMediaVideoEnhanceTemplate.php ├── createMediaVideoMontageJobs.php ├── createMediaVideoMontageTemplate.php ├── createMediaVideoProcessJobs.php ├── createMediaVideoProcessTemplate.php ├── createMediaVideoTagJobs.php ├── createMediaVoiceSeparateJobs.php ├── createMediaVoiceSeparateTemplate.php ├── createMediaWatermarkTemplate.php ├── createMultipartUpload.php ├── createVoiceSoundHoundJobs.php ├── createVoiceSpeechRecognitionJobs.php ├── createVoiceSpeechRecognitionTemplate.php ├── createVoiceTtsJobs.php ├── createVoiceTtsTemplate.php ├── createVoiceVocalScoreJobs.php ├── deleteBucket.php ├── deleteBucketCors.php ├── deleteBucketDomain.php ├── deleteBucketGuetzli.php ├── deleteBucketImageStyle.php ├── deleteBucketLifecycle.php ├── deleteBucketTagging.php ├── deleteBucketWebsite.php ├── deleteBuckets.php ├── deleteFolder.php ├── deleteObject.php ├── deleteObjectTagging.php ├── deleteWorkflow.php ├── describeInventoryTriggerJob.php ├── describeInventoryTriggerJobs.php ├── describeMediaJob.php ├── describeMediaJobs.php ├── describeMediaTemplates.php ├── describeWorkflow.php ├── detectAudio.php ├── detectDocument.php ├── detectImage.php ├── detectImages.php ├── detectLabelProcess.php ├── detectLable.php ├── detectLiveVideo.php ├── detectPetProcess.php ├── detectText.php ├── detectVideo.php ├── detectVirus.php ├── detectWebpage.php ├── document2dstType.php ├── doesBucketExist.php ├── doesObjectExist.php ├── download.php ├── downloadFolder.php ├── fileJobs4Hash.php ├── getActionSequence.php ├── getAiBucketList.php ├── getAiQueueList.php ├── getAsrBucketList.php ├── getAsrQueueList.php ├── getBlindWatermark.php ├── getBucketAccelerate.php ├── getBucketAcl.php ├── getBucketCors.php ├── getBucketDomain.php ├── getBucketGuetzli.php ├── getBucketImageStyle.php ├── getBucketInventory.php ├── getBucketLifecycle.php ├── getBucketLogging.php ├── getBucketReferer.php ├── getBucketTagging.php ├── getBucketWebsite.php ├── getCiService.php ├── getDescribeDocProcessBuckets.php ├── getDescribeDocProcessJob.php ├── getDescribeDocProcessJobs.php ├── getDescribeDocProcessQueues.php ├── getDescribeMediaBuckets.php ├── getDescribeMediaQueues.php ├── getDescribeMediaVoiceSeparateJob.php ├── getDetectAudioResult.php ├── getDetectDocumentResult.php ├── getDetectImageResult.php ├── getDetectTextResult.php ├── getDetectVideoResult.php ├── getDetectVirusResult.php ├── getDetectWebpageResult.php ├── getFileCompressResult.php ├── getFileHashCodeResult.php ├── getFileProcessQueueList.php ├── getFileUncompressResult.php ├── getHotLink.php ├── getImageSlim.php ├── getLiveCode.php ├── getMediaInfo.php ├── getObject.php ├── getObjectSensitiveContentRecognition.php ├── getObjectTagging.php ├── getObjectUrl.php ├── getObjectWithoutSign.php ├── getOriginProtect.php ├── getPicBucketList.php ├── getPicQueueList.php ├── getPresignedUrl.php ├── getPrivateM3U8.php ├── getSnapshot.php ├── getWorkflowInstance.php ├── getWorkflowInstances.php ├── goodsMattingProcess.php ├── headBucket.php ├── headObject.php ├── iDCardOCR.php ├── imageAssessQualityProcess.php ├── imageAve.php ├── imageDetectCarProcess.php ├── imageDetectFace.php ├── imageExif.php ├── imageFaceEffect.php ├── imageInfo.php ├── imageMogr.php ├── imageProcess.php ├── imageProcessBright.php ├── imageProcessChannel.php ├── imageProcessContrast.php ├── imageProcessCrop.php ├── imageProcessFormat.php ├── imageProcessFormatAvif.php ├── imageProcessFormatHeif.php ├── imageProcessFormatSvgc.php ├── imageProcessFormatTpg.php ├── imageProcessFormatWebp.php ├── imageProcessGaussianBlur.php ├── imageProcessGrayscale.php ├── imageProcessImageView.php ├── imageProcessQuality.php ├── imageProcessRotate.php ├── imageProcessSharpen.php ├── imageProcessSizeLimit.php ├── imageProcessStrip.php ├── imageProcessThumbnail.php ├── imageProcessWatermarkImage.php ├── imageProcessWatermarkText.php ├── imageRepairProcess.php ├── imageView.php ├── imageWatermark.php ├── listBuckets.php ├── listMultipartUploads.php ├── listObjects.php ├── listParts.php ├── livenessRecognitionProcess.php ├── openAiService.php ├── openAsrService.php ├── openFileProcessService.php ├── openImageSlim.php ├── openOriginProtect.php ├── opticalOcrRecognition.php ├── picOperations.php ├── putBlindWatermark.php ├── putBucketAccelerate.php ├── putBucketAcl.php ├── putBucketCors.php ├── putBucketDomain.php ├── putBucketGuetzli.php ├── putBucketImageStyle.php ├── putBucketInventory.php ├── putBucketLifecycle.php ├── putBucketLogging.php ├── putBucketReferer.php ├── putBucketTagging.php ├── putBucketWebsite.php ├── putImageStyle.php ├── putObject.php ├── putObjectTagging.php ├── putQrcode.php ├── qrcode.php ├── qrcodeGenerate.php ├── recognizeLogoProcess.php ├── restoreObject.php ├── selectObjectContent.php ├── sts_ci_demo.php ├── sts_demo.php ├── textWatermark.php ├── trafficLimit.php ├── triggerWorkflow.php ├── unBindCiService.php ├── updateAiQueue.php ├── updateAsrQueue.php ├── updateDocProcessQueue.php ├── updateFileProcessQueue.php ├── updateMediaAnimationTemplate.php ├── updateMediaConcatTemplate.php ├── updateMediaHighSpeedHdTemplate.php ├── updateMediaNoiseReductionTemplate.php ├── updateMediaPicProcessTemplate.php ├── updateMediaQueue.php ├── updateMediaSmartCoverTemplate.php ├── updateMediaSnapshotTemplate.php ├── updateMediaSuperResolutionTemplate.php ├── updateMediaTargetRecTemplate.php ├── updateMediaTranscodeProTemplate.php ├── updateMediaTranscodeTemplate.php ├── updateMediaVideoEnhanceTemplate.php ├── updateMediaVideoMontageTemplate.php ├── updateMediaVideoProcessTemplate.php ├── updateMediaVoiceSeparateTemplate.php ├── updateMediaWatermarkTemplate.php ├── updatePicQueue.php ├── updateVoiceSpeechRecognitionTemplate.php ├── updateVoiceTtsTemplate.php ├── upload.php ├── uploadFolder.php └── uploadPart.php └── src ├── Client.php ├── CommandToRequestTransformer.php ├── Common.php ├── Copy.php ├── Descriptions.php ├── Exception ├── CosException.php └── ServiceResponseException.php ├── ExceptionMiddleware.php ├── ExceptionParser.php ├── ImageParamTemplate ├── BlindWatermarkTemplate.php ├── CIParamTransformation.php ├── CIProcessTransformation.php ├── ImageMogrTemplate.php ├── ImageQrcodeTemplate.php ├── ImageSlimTemplate.php ├── ImageStyleTemplate.php ├── ImageTemplate.php ├── ImageViewTemplate.php ├── ImageWatermarkTemplate.php ├── PicOperationsTransformation.php └── TextWatermarkTemplate.php ├── MultipartUpload.php ├── RangeDownload.php ├── Request ├── BodyLocation.php └── XmlLocation.php ├── ResultTransformer.php ├── Serializer.php ├── Service.php ├── Signature.php └── SignatureMiddleware.php /.github/workflows/format.yml: -------------------------------------------------------------------------------- 1 | name: format 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | format: 9 | name: Format Code 10 | runs-on: "${{ matrix.os }}" 11 | strategy: 12 | matrix: 13 | os: [ubuntu-latest] 14 | php-version: ['8.0'] 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | 19 | - name: Setup PHP 20 | uses: shivammathur/setup-php@v2 21 | with: 22 | php-version: ${{ matrix.php-version }} 23 | coverage: none 24 | 25 | - name: Setup Dependencies 26 | run: 27 | composer install -o 28 | 29 | - name: Run 30 | run: | 31 | php bin/format 32 | php bin/release 33 | 34 | - name: Commit Updated 35 | uses: stefanzweifel/git-auto-commit-action@v4 36 | with: 37 | commit_message: Format code 38 | -------------------------------------------------------------------------------- /.github/workflows/install.yml: -------------------------------------------------------------------------------- 1 | name: Support Multiple Versions 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | install: 9 | name: PHP${{ matrix.php-version }} Test Install 10 | runs-on: "${{ matrix.os }}" 11 | strategy: 12 | matrix: 13 | os: [ubuntu-latest] 14 | php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] 15 | max-parallel: 10 16 | fail-fast: false 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | 21 | - name: Setup PHP 22 | uses: shivammathur/setup-php@v2 23 | with: 24 | php-version: ${{ matrix.php-version }} 25 | coverage: none 26 | 27 | - name: Setup Dependencies 28 | run: 29 | composer install -o 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 腾讯云 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /sample/CreateDatasetBinding.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //本文档介绍创建数据集(Dataset)和对象存储(COS)Bucket 的绑定关系,绑定后将使用创建数据集时所指定算子对文件进行处理。绑定关系创建后,将对 COS 中新增的文件进行准实时的增量追踪扫描,使用创建数据集时所指定算子对文件进行处理,抽取文件元数据信息进行索引。通过此方式为文件建立索引后,您可以使用元数据查询API对元数据进行查询、管理和统计。 17 | $result = $cosClient->CreateDatasetBinding(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是 24 | 'URI'=> 'cos://examplebucket-1250000000', // 资源标识字段,表示需要与数据集绑定的资源,当前仅支持COS存储桶,字段规则:cos://,其中BucketName表示COS存储桶名称,例如:cos://examplebucket-1250000000;是否必传:是 25 | 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/DatasetFaceSearch.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //从数据集中搜索与指定图片最相似的前N张图片并返回人脸坐标可对数据集内文件进行一个或多个人员的人脸识别。 17 | $result = $cosClient->DatasetFaceSearch(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是 24 | 'URI'=> 'cos://examplebucket-1250000000/test.jpg', // 资源标识字段,表示需要建立索引的文件地址。;是否必传:是 25 | 'MaxFaceNum'=> 1, // 输入图片中检索的人脸数量,默认值为1(传0或不传采用默认值),最大值为10。;是否必传:否 26 | 'Limit'=> 10, // 检索的每张人脸返回相关人脸数量,默认值为10,最大值为100。;是否必传:否 27 | 'MatchThreshold'=> 10, // 出参 Score 中,只有超过 MatchThreshold 值的结果才会返回。范围:1-100,默认值为0,推荐值为80。;是否必传:否 28 | 29 | )); 30 | // 请求成功 31 | print_r($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/DeleteDataset.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //删除一个数据集(Dataset)。 17 | $result = $cosClient->DeleteDataset(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是 24 | 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/DeleteDatasetBinding.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //解绑数据集和对象存储(COS)Bucket ,解绑会导致 COS Bucket新增的变更不会同步到数据集,请谨慎操作。 17 | $result = $cosClient->DeleteDatasetBinding(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是 24 | 'URI'=> 'cos://examplebucket-1250000000', // 资源标识字段,表示需要与数据集绑定的资源,当前仅支持COS存储桶,字段规则:cos://,其中BucketName表示COS存储桶名称,例如:cos://examplebucket-1250000000;是否必传:是 25 | 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/DeleteFileMetaIndex.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //从数据集内删除一个文件的元信息。无论该文件的元信息是否在数据集内存在,均会返回删除成功。 17 | $result = $cosClient->DeleteFileMetaIndex(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Content-Type' => 'application/json', 21 | ), 22 | 'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是 23 | 'URI'=> 'cos://examplebucket-1250000000/test.jpg', // 资源标识字段,表示需要建立索引的文件地址。;是否必传:是 24 | 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/DescribeDataset.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //查询一个数据集(Dataset)信息。 17 | $result = $cosClient->DescribeDataset(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'datasetname' => '', // 数据集名称,同一个账户下唯一。 24 | 'statistics' => 'false', // 是否需要实时统计数据集中文件相关信息。有效值: false:不统计,返回的文件的总大小、数量信息可能不正确也可能都为0。 true:需要统计,返回数据集中当前的文件的总大小、数量信息。 默认值为false。 25 | 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/DescribeDatasetBinding.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //查询数据集和对象存储(COS)Bucket 绑定关系列表。 17 | $result = $cosClient->DescribeDatasetBinding(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'datasetname' => '数据集名称', // 数据集名称,同一个账户下唯一。 24 | 'uri' => 'uri', // 资源标识字段,表示需要与数据集绑定的资源,当前仅支持COS存储桶,字段规则:cos://,其中BucketName表示COS存储桶名称,例如(需要进行urlencode):cos%3A%2F%2Fexample-125000 25 | 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/DescribeDatasetBindings.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //查询数据集和对象存储(COS)Bucket 绑定关系列表。 17 | $result = $cosClient->DescribeDatasetBindings(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'datasetname' => '数据集名称', // 数据集名称,同一个账户下唯一。 24 | 'maxresults' => '最大个数', // 返回绑定关系的最大个数,取值范围为0~200。不设置此参数或者设置为0时,则默认值为100。 25 | 'nexttoken' => '下一页', // 当绑定关系总数大于设置的MaxResults时,用于翻页的token。从NextToken开始按字典序返回绑定关系信息列表。第一次调用此接口时,设置为空。 26 | 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo($e); 33 | } 34 | -------------------------------------------------------------------------------- /sample/DescribeDatasets.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //获取数据集(Dataset)列表。 17 | $result = $cosClient->DescribeDatasets(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'maxresults' => 100, // 本次返回数据集的最大个数,取值范围为0~200。不设置此参数或者设置为0时,则默认值为100。 24 | 'nexttoken' => '下一页', // 翻页标记。当文件总数大于设置的MaxResults时,用于翻页的Token。从NextToken开始按字典序返回文件信息列表。填写上次查询返回的值,首次使用时填写为空。 25 | 'prefix' => '数据集前缀', // 数据集名称前缀。 26 | 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo($e); 33 | } 34 | -------------------------------------------------------------------------------- /sample/DescribeFileMetaIndex.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //获取数据集内已完成索引的一个文件的元数据。 17 | $result = $cosClient->DescribeFileMetaIndex(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'datasetname' => '', // 数据集名称,同一个账户下唯一。 24 | 'uri' => '', // 资源标识字段,表示需要建立索引的文件地址,当前仅支持COS上的文件,字段规则:cos:///,其中BucketName表示COS存储桶名称,ObjectKey表示文件完整路径,例如:cos://examplebucket-1250000000/test1/img.jpg。 注意: 1、仅支持本账号内的COS文件 2、不支持HTTP开头的地址 3、需UrlEncode 25 | 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/GetHLSPlayKeyDemo.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //该接口用于获取hls播放密钥。 17 | $result = $cosClient->GetHLSPlayKey(array( 18 | 'Bucket' => '###bucketName###', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Headers' => array( 20 | 'Content-Type' => 'application/xml', 21 | ), 22 | 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/GetHLSTokenDemo.php: -------------------------------------------------------------------------------- 1 | 'HS256', 9 | 'typ' => 'JWT' 10 | ); 11 | $payload = array( 12 | "Type" => "CosCiToken", 13 | "AppId" => "1250000000", 14 | "BucketId" => $bucket, 15 | "Object" => "exampleobject", 16 | "Issuer" => "client", 17 | "IssuedTimeStamp" => time(), 18 | "ExpireTimeStamp" => time() + 3600 * 6, 19 | "UsageLimit" => 3, 20 | "ProtectScheme" => "rsa1024", 21 | "PublicKey" => base64_encode($publicKey), 22 | "ProtectContentKey" => 1, 23 | ); 24 | $base64header = base64UrlEncode(json_encode($header, JSON_UNESCAPED_UNICODE)); 25 | $base64payload = base64UrlEncode(json_encode($payload, JSON_UNESCAPED_UNICODE)); 26 | $token = $base64header . '.' . $base64payload . '.' . base64UrlEncode(hash_hmac('sha256', $base64header . '.' . $base64payload, $playKey, true)); 27 | echo $token; 28 | 29 | function base64UrlEncode($input) { 30 | return str_replace('=', '', strtr(base64_encode($input), '+/', '-_')); 31 | } 32 | -------------------------------------------------------------------------------- /sample/ImageSearch.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 图片搜索接口 https://cloud.tencent.com/document/product/460/63901 17 | $result = $cosClient->imageSearch(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // ObjectKey 20 | 'MatchThreshold' => 0, // 出参 Score 中,只有超过 MatchThreshold 值的结果才会返回。默认为0 21 | 'Offset' => 0, // 起始序号,默认值为0 22 | 'Limit' => 10, // 返回数量,默认值为10,最大值为100 23 | 'Filter' => '', // 针对入库时提交的 Tags 信息进行条件过滤。支持>、>=、<、<=、=、!=,多个条件之间支持 AND 和 OR 进行连接 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/ImageSearchAdd.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 添加图库图片 https://cloud.tencent.com/document/product/460/63900 17 | $result = $cosClient->imageSearchAdd(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // ObjectKey 20 | 'EntityId' => '', // 物品 ID,最多支持64个字符。若 EntityId 已存在,则对其追加图片 21 | 'CustomContent' => '', // 用户自定义的内容,最多支持4096个字符,查询时原样带回 22 | 'Tags' => '', // 图片自定义标签,最多不超过10个,json 字符串,格式为 key:value 对 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/ImageSearchDelete.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 删除图库图片 https://cloud.tencent.com/document/product/460/63902 17 | $result = $cosClient->imageSearchDelete(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // ObjectKey 20 | 'EntityId' => '', // 物品 ID 21 | )); 22 | // 请求成功 23 | print_r($result); 24 | } catch (\Exception $e) { 25 | // 请求失败 26 | echo($e); 27 | } 28 | -------------------------------------------------------------------------------- /sample/ImageSearchOpen.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 开通以图搜图 https://cloud.tencent.com/document/product/460/63899 17 | $result = $cosClient->imageSearchOpen(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'MaxCapacity' => 10000, // 图库容量限制 20 | 'MaxQps' => 10, // 图库访问限制,默认10 21 | )); 22 | // 请求成功 23 | print_r($result); 24 | } catch (\Exception $e) { 25 | // 请求失败 26 | echo($e); 27 | } 28 | -------------------------------------------------------------------------------- /sample/SearchImage.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //可通过输入自然语言或图片,基于语义对数据集内文件进行图像检索。 17 | $result = $cosClient->SearchImage(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'DatasetName'=> 'ImageSearch001', // 数据集名称,同一个账户下唯一。;是否必传:是 24 | 'Mode'=> 'pic', // 指定检索方式为图片或文本,pic 为图片检索,text 为文本检索,默认为 pic。;是否必传:否 25 | 'URI'=> 'cos://examplebucket-1250000000/huge_base.jpg', // 资源标识字段,表示需要建立索引的文件地址(Mode 为 pic 时必选)。;是否必传:否 26 | 'Limit'=> 10, // 返回相关图片的数量,默认值为10,最大值为100。;是否必传:否 27 | 'MatchThreshold'=> 1, // 出参 Score(相关图片匹配得分) 中,只有超过 MatchThreshold 值的结果才会返回。默认值为0,推荐值为80。;是否必传:否 28 | 29 | )); 30 | // 请求成功 31 | print_r($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/UpdateDataset.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //更新一个数据集(Dataset)信息。 17 | $result = $cosClient->UpdateDataset(array( 18 | 'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer 19 | 'Headers' => array( 20 | 'Accept' => 'application/json', 21 | 'Content-Type' => 'application/json', 22 | ), 23 | 'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是 24 | 'Description'=> 'test', // 数据集描述信息。长度为1~256个英文或中文字符,默认值为空。;是否必传:否 25 | 'TemplateId'=> 'Official:COSBasicMeta', // 该参数表示模板,在建立元数据索引时,后端将根据模板来决定收集哪些元数据。每个模板都包含一个或多个算子,不同的算子表示不同的元数据。目前支持的模板: Official:Empty:默认为空的模板,表示不进行元数据的采集。 Official:COSBasicMeta:基础信息模板,包含COS文件基础元信息算子,表示采集cos文件的名称、类型、acl等基础元信息数据。;是否必传:否 26 | 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo($e); 33 | } 34 | -------------------------------------------------------------------------------- /sample/ZipFilePreviewDemo.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId , 14 | 'secretKey' => $secretKey))); 15 | try { 16 | //该接口可以在不解压文件的情况下预览压缩包内的内容,包含文件数量、名称、文件时间等,接口为同步请求方式 17 | $result = $cosClient->ZipFilePreview(array( 18 | 'Bucket' => 'test-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => 'for-test.zip', // 文件名称 20 | 'Headers' => array( 21 | 'Content-Type' => 'application/xml', 22 | ), 23 | 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/abortMultipartUpload.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->abortMultipartUpload(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'UploadId' => 'string', 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/addHotLink.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 设置防盗链 https://cloud.tencent.com/document/product/460/30116 17 | $result = $cosClient->addHotLink(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Urls' => array( 20 | 'www.example1.com', 21 | 'www.example2.com', 22 | 'www.example3.com', 23 | ), 24 | 'Type' => 'white', 25 | )); 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/appendObject.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | $local_path = "/data/exampleobject"; 16 | try { 17 | $result = $cosClient->appendObject(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => 'exampleobject', 20 | 'Position' => 0, //追加对象位置 21 | 'Body' => fopen($local_path, 'rb'),//读取文件内容 22 | )); 23 | /* 24 | $result = $cosClient->appendObject(array( 25 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 26 | 'Key' => 'exampleobject', 27 | 'Position' => (integer)$result['Position'], //取出上一个追加文件的对象位置进行追加 28 | 'Body' => "hello", //文件流 29 | )); 30 | */ 31 | // 请求成功 32 | print_r($result); 33 | } catch (\Exception $e) { 34 | // 请求失败 35 | echo($e); 36 | } 37 | -------------------------------------------------------------------------------- /sample/autoTranslationBlockProcess.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 实时文字翻译 17 | $result = $cosClient->autoTranslationBlockProcess(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'InputText' => '', // 待翻译的文本 20 | 'SourceLang' => '', // 输入语言,如 "zh" 21 | 'TargetLang' => '', // 输出语言,如 "en" 22 | // 'TextDomain' => '', // 文本所属业务领域,如: "ecommerce", //缺省值为 general 23 | // 'TextStyle' => '', // 文本类型,如: "title", //缺省值为 sentence 24 | )); 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/bindCiService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 绑定数据万象服务 https://cloud.tencent.com/document/product/460/30108 17 | $result = $cosClient->bindCiService(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/cancelInventoryTriggerJob.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/71515 取消存量任务 17 | $result = $cosClient->cancelInventoryTriggerJob(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // jobId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/cancelLiveVideoAuditing.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->cancelLiveVideoAuditing(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/catchException.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketAcl(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | $statusCode = $e->getStatusCode(); // 获取错误码 24 | $errorMessage = $e->getMessage(); // 获取错误信息 25 | $requestId = $e->getRequestId(); // 获取错误的requestId 26 | $errorCode = $e->getCosErrorCode(); // 获取错误名称 27 | $request = $e->getRequest(); // 获取完整的请求 28 | $response = $e->getResponse(); // 获取完整的响应 29 | } 30 | -------------------------------------------------------------------------------- /sample/closeAiService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须用https 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 关闭AI内容识别服务 17 | $result = $cosClient->closeAiService(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/closeAsrService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须用https 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 关闭智能语音服务 https://cloud.tencent.com/document/product/460/95755 17 | $result = $cosClient->closeAsrService(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/closeImageSlim.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->closeImageSlim(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | print_r($result); 20 | } catch (\Exception $e) { 21 | // 请求失败 22 | echo($e); 23 | } 24 | -------------------------------------------------------------------------------- /sample/closeOriginProtect.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 关闭原图保护 https://cloud.tencent.com/document/product/460/30122 17 | $result = $cosClient->closeOriginProtect(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/completeMultipartUpload.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->completeMultipartUpload(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'UploadId' => 'string', 20 | 'Parts' => array( 21 | array( 22 | 'ETag' => 'string', 23 | 'PartNumber' => integer, 24 | ), 25 | array( 26 | 'ETag' => 'string', 27 | 'PartNumber' => integer, 28 | )), 29 | // ... repeated 30 | )); 31 | // 请求成功 32 | print_r($result); 33 | } catch (\Exception $e) { 34 | // 请求失败 35 | echo($e); 36 | } 37 | -------------------------------------------------------------------------------- /sample/copy.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | $local_path = "/data/exampleobject"; 16 | try { 17 | $result = $cosClient->copy( 18 | $bucket = 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | $key = 'exampleobject', 20 | $copySource = array( 21 | 'Region' => '', 22 | 'Bucket' => '', 23 | 'Key' => '', 24 | ) 25 | ); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/copyObject.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->copyObject(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'CopySource' => urlencode('examplebucket2-125000000.cos.ap-guangzhou.myqcloud.com/exampleobject'), //请注意这里需要urlencode,防止因特殊字符产生的400或404错误 20 | 'MetadataDirective' => 'Replaced', 21 | )); 22 | // 请求成功 23 | print_r($result); 24 | } catch (\Exception $e) { 25 | // 请求失败 26 | echo($e); 27 | } 28 | -------------------------------------------------------------------------------- /sample/cosClient.php: -------------------------------------------------------------------------------- 1 | $region, //园区 12 | 'scheme' => 'https', //协议头部,默认为http 13 | 'timeout' => 10, //超时时间 14 | 'connect_timeout' => 10, //连接超时时间 15 | 'ip' => '', //ip 16 | 'port' => '', //端口 17 | 'endpoint' => '', //endpoint 18 | 'domain' => '', //domain可以填写用户自定义域名,或者桶的全球加速域名 19 | 'proxy' => '', //代理服务器 20 | 'retry' => 10, //重试次数 21 | 'userAgent' => '', //UA 22 | 'allow_redirects' => false, //是否follow302 23 | 'credentials'=> array( 24 | 'secretId' => $secretId, 25 | 'secretKey' => $secretKey, 26 | 'token' => $token, 27 | 'anonymous' => true, //匿名模式 28 | ), 29 | 'timezone' => 'PRC', //时区 30 | 'locationWithScheme' => true //Location中是否包含scheme 31 | ) 32 | ); 33 | -------------------------------------------------------------------------------- /sample/createBucket.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->createBucket(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/createFolder.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putObject(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'folder/', 19 | 'Body' => "", 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/createMediaNoiseReductionTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 创建音频降噪模板 https://cloud.tencent.com/document/product/460/94315 17 | $result = $cosClient->createMediaNoiseReductionTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'NoiseReduction', 20 | 'Name' => 'NoiseReduction-Template', 21 | 'NoiseReduction' => array( 22 | 'Format' => 'wav', 23 | 'Samplerate' => '16000', 24 | ), 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/createMediaPicProcessTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/67225 新增图片处理模板 17 | $result = $cosClient->createMediaPicProcessTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'PicProcess', 20 | 'Name' => 'PicProcess-Template-Name', 21 | 'PicProcess' => array( 22 | 'IsPicInfo' => '', 23 | 'ProcessRule' => 'imageMogr2/rotate/90', 24 | ), 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/createMediaSmartCoverTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须使用https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 创建智能封面模板 https://cloud.tencent.com/document/product/460/84734 17 | $result = $cosClient->createMediaSmartCoverTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'SmartCover', 20 | 'Name' => 'media-smartcover-name', 21 | 'SmartCover' => array( 22 | 'Format' => 'jpg', 23 | 'Width' => '1280', 24 | 'Height' => '960', 25 | 'Count' => '3', 26 | 'DeleteDuplicates' => 'true', 27 | ), 28 | )); 29 | // 请求成功 30 | print_r($result); 31 | } catch (\Exception $e) { 32 | // 请求失败 33 | echo($e); 34 | } 35 | -------------------------------------------------------------------------------- /sample/createMediaSnapshotTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/54029 新增截图模板 17 | $result = $cosClient->createMediaSnapshotTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'Snapshot', 20 | 'Name' => 'Snapshot-Template-Name', 21 | 'Snapshot' => array( 22 | 'Mode' => '', 23 | 'Start' => '', 24 | 'TimeInterval' => '', 25 | 'Count' => '', 26 | 'Width' => '', 27 | 'Height' => '', 28 | ), 29 | )); 30 | // 请求成功 31 | print_r($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/createMediaSuperResolutionTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->createMediaSuperResolutionTemplate(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Tag' => 'SuperResolution', 19 | 'Name' => 'SuperResolution-Template-Name', 20 | 'Resolution' => '', 21 | 'EnableScaleUp' => '', 22 | 'Version' => '', 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/createMediaTargetRecTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 创建视频目标检测模板 17 | $result = $cosClient->createMediaTargetRecTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'VideoTargetRec', 20 | 'Name' => 'template-name', 21 | 'VideoTargetRec' => array( 22 | 'Body' => 'true', 23 | 'Pet' => 'true', 24 | 'Car' => 'false', 25 | ), // Body、Pet、Car 不能同时为 false 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/createMediaVideoProcessTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/60745 新增视频增强模板 17 | $result = $cosClient->createMediaVideoProcessTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'VideoProcess', 20 | 'Name' => 'VideoProcess-Template-Name', 21 | 'ColorEnhance' => array( 22 | 'Enable' => '', 23 | 'Contrast' => '', 24 | 'Correction' => '', 25 | 'Saturation' => '', 26 | ), 27 | 'MsSharpen' => array( 28 | 'Enable' => '', 29 | 'SharpenLevel' => '', 30 | ), 31 | )); 32 | // 请求成功 33 | print_r($result); 34 | } catch (\Exception $e) { 35 | // 请求失败 36 | echo($e); 37 | } 38 | -------------------------------------------------------------------------------- /sample/createMediaVideoTagJobs.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 提交视频标签任务 https://cloud.tencent.com/document/product/436/67202 17 | $result = $cosClient->createMediaVideoTagJobs(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'VideoTag', 20 | 'Input' => array( 21 | 'Object' => 'video01.mp4' 22 | ), 23 | 'Operation' => array( 24 | 'VideoTag' => array( 25 | 'Scenario' => 'Stream', 26 | ), 27 | // 'UserData' => 'xxx', // 透传用户信息 28 | // 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0 29 | ), 30 | 'CallBack' => '', 31 | )); 32 | // 请求成功 33 | print_r($result); 34 | } catch (\Exception $e) { 35 | // 请求失败 36 | echo($e); 37 | } 38 | -------------------------------------------------------------------------------- /sample/createMediaVoiceSeparateTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/58315 新增人声分离模板 17 | $result = $cosClient->createMediaVoiceSeparateTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'VoiceSeparate', 20 | 'Name' => 'VoiceSeparate-Template-Name', 21 | 'AudioMode' => 'IsAudio', 22 | 'AudioConfig' => array( 23 | 'Codec' => 'aac', 24 | 'Samplerate' => '', 25 | 'Bitrate' => '', 26 | 'Channels' => '', 27 | ), 28 | )); 29 | // 请求成功 30 | print_r($result); 31 | } catch (\Exception $e) { 32 | // 请求失败 33 | echo($e); 34 | } 35 | -------------------------------------------------------------------------------- /sample/createMultipartUpload.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->createMultipartUpload(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | /* 20 | 'CacheControl' => 'string', 21 | 'ContentDisposition' => 'string', 22 | 'ContentEncoding' => 'string', 23 | 'ContentLanguage' => 'string', 24 | 'ContentLength' => integer, 25 | 'ContentType' => 'string', 26 | 'Expires' => 'string', 27 | 'Metadata' => array( 28 | 'string' => 'string', 29 | ), 30 | 'StorageClass' => 'string' 31 | */ 32 | )); 33 | // 请求成功 34 | print_r($result); 35 | } catch (\Exception $e) { 36 | // 请求失败 37 | echo($e); 38 | } 39 | -------------------------------------------------------------------------------- /sample/createVoiceTtsTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须使用https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 创建语音合成模板 https://cloud.tencent.com/document/product/460/84499 17 | $result = $cosClient->createVoiceTtsTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => 'Tts', 20 | 'Name' => 'TemplateName', 21 | 'Mode' => 'Sync', 22 | 'Codec' => 'pcm', 23 | 'VoiceType' => 'aixiaoxing', 24 | 'Volume' => '2', 25 | 'Speed' => '200', 26 | 'Emotion' => 'arousal', 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo($e); 33 | } 34 | -------------------------------------------------------------------------------- /sample/deleteBucket.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteBucket(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/deleteBucketCors.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteBucketCors(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/deleteBucketDomain.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteBucketDomain(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo "$e\n"; 24 | } 25 | -------------------------------------------------------------------------------- /sample/deleteBucketGuetzli.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->DeleteBucketGuetzli(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/deleteBucketImageStyle.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->DeleteBucketImageStyle(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'StyleName' => 'stylename', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/deleteBucketLifecycle.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteBucketLifecycle(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/deleteBucketTagging.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteBucketTagging(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/deleteBucketWebsite.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteBucketWebsite(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo "$e\n"; 24 | } 25 | -------------------------------------------------------------------------------- /sample/deleteObject.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteObject(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/deleteObjectTagging.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->deleteObjectTagging(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/deleteWorkflow.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/53990 删除工作流 17 | $result = $cosClient->deleteWorkflow(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // WorkflowId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/describeInventoryTriggerJob.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/71517 查询存量任务 17 | $result = $cosClient->describeInventoryTriggerJob(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // jobId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/describeInventoryTriggerJobs.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/71518 批量拉取存量任务 17 | $result = $cosClient->describeInventoryTriggerJobs(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | // 'NextToken' => '', 20 | // 'Size' => '', 21 | // 'OrderByTime' => '', 22 | // 'States' => '', 23 | // 'StartCreationTime' => '', 24 | // 'EndCreationTime' => '', 25 | // 'WorkflowId' => '', 26 | // 'JobId' => '', 27 | // 'Name' => '', 28 | )); 29 | // 请求成功 30 | print_r($result); 31 | } catch (\Exception $e) { 32 | // 请求失败 33 | echo($e); 34 | } 35 | -------------------------------------------------------------------------------- /sample/describeMediaJob.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 查询指定的任务 17 | $result = $cosClient->describeMediaJob(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // jobId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/describeMediaTemplates.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 查询模版列表 17 | $result = $cosClient->describeMediaTemplates(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Tag' => '', // 模板 Tag:Animation、Snapshot、Watermark、Transcode、Concat、HighSpeedHd、VideoMontage、VoiceSeparate、VideoProcess、PicProcess 20 | 'Category' => 'Custom', 21 | 'Ids' => '', 22 | 'Name' => '', 23 | 'PageNumber' => '', 24 | 'PageSize' => '', 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/describeWorkflow.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/53991 搜索工作流 17 | $result = $cosClient->describeWorkflow(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | // 'Ids' => '', 20 | // 'Name' => '', 21 | // 'PageNumber' => '', 22 | // 'PageSize' => '', 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/detectLable.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->DetectLabel(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/doesBucketExist.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->doesBucketExist( 17 | 'examplebucket-125000000'//存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | ); ; 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/doesObjectExist.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->doesObjectExist( 17 | 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'exampleobject' //对象名 19 | ); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/fileJobs4Hash.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/83107 哈希值计算同步请求 17 | $result = $cosClient->FileJobs4Hash(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => 'for-test.mp4', // 桶文件 20 | 'Type' => 'md5', // 支持的哈希算法类型,有效值:md5、sha1、sha256 21 | // 'AddToHeader' => 'true', // 是否将计算得到的哈希值,自动添加至文件的自定义header,格式为:x-cos-meta-md5/sha1/sha256; 有效值: true、false,不填则默认为false。 22 | )); 23 | // 请求成功 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | /** 29 | * 可能出现的 Exception 30 | * 1. Error Message: file processing is not active yet, please apply for file processing service first 31 | * 解决方式:开通文件处理服务 32 | */ 33 | } 34 | -------------------------------------------------------------------------------- /sample/getActionSequence.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 获取动作顺序 https://cloud.tencent.com/document/product/460/48648 17 | $result = $cosClient->getActionSequence(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getAiBucketList.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须用https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | // 查询 AI 内容识别服务状态 https://cloud.tencent.com/document/product/460/79594 18 | $result = $cosClient->getAiBucketList(array( 19 | // 'Regions' => '', // 可选 地域信息,例如 ap-shanghai、ap-beijing,若查询多个地域以“,”分隔字符串 20 | // 'BucketNames' => '', // 可选 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索 21 | // 'BucketName' => '', // 可选 存储桶名称前缀,前缀搜索 22 | // 'PageNumber' => 1, // 可选 第几页 23 | // 'PageSize' => 20, // 可选 每页个数 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/getAiQueueList.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须为https 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 搜索 AI 内容识别队列 https://cloud.tencent.com/document/product/460/79394 17 | $result = $cosClient->getAiQueueList(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | // 'QueueIds' => 'xxx', // 队列 ID,以“,”符号分割字符串 20 | // 'State' => 'Active', // Active 表示队列内的作业会被媒体处理服务调度执行, Paused 表示队列暂停,作业不再会被媒体处理调度执行,队列内的所有作业状态维持在暂停状态,已经执行中的任务不受影响 21 | // 'PageNumber' => '1', // 第几页 22 | // 'PageSize' => '10', // 每页个数 23 | )); 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | } 29 | -------------------------------------------------------------------------------- /sample/getAsrBucketList.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须用https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | // 查询智能语音服务 https://cloud.tencent.com/document/product/460/46232 18 | $result = $cosClient->getAsrBucketList(array( 19 | // 'Regions' => '', // 可选 地域信息,例如 ap-shanghai、ap-beijing,若查询多个地域以“,”分隔字符串 20 | // 'BucketNames' => '', // 可选 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索 21 | // 'BucketName' => '', // 可选 存储桶名称前缀,前缀搜索 22 | // 'PageNumber' => 1, // 可选 第几页 23 | // 'PageSize' => 20, // 可选 每页个数 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/getAsrQueueList.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须为https 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 查询智能语音队列 https://cloud.tencent.com/document/product/460/46234 17 | $result = $cosClient->getAsrQueueList(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | // 'QueueIds' => 'xxx', // 队列 ID,以“,”符号分割字符串 20 | // 'State' => 'Active', // Active 表示队列内的作业会被媒体处理服务调度执行, Paused 表示队列暂停,作业不再会被媒体处理调度执行,队列内的所有作业状态维持在暂停状态,已经执行中的任务不受影响 21 | // 'PageNumber' => '1', // 第几页 22 | // 'PageSize' => '10', // 每页个数 23 | )); 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | } 29 | -------------------------------------------------------------------------------- /sample/getBucketAccelerate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketAccelerate(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketAcl.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketAcl(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketCors.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketCors(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketDomain.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketDomain(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo "$e\n"; 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketGuetzli.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->GetBucketGuetzli(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketImageStyle.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->GetBucketImageStyle(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'StyleName' => 'stylename', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getBucketInventory.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketInvnetory(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Id' => 'string', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getBucketLifecycle.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketLifecycle(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketLogging.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketLogging(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketReferer.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketReferer(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | ) 19 | ); 20 | // 请求成功 21 | echo($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getBucketTagging.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketTagging(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getBucketWebsite.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getBucketWebsite(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo "$e\n"; 24 | } 25 | -------------------------------------------------------------------------------- /sample/getCiService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 查询数据万象服务 https://cloud.tencent.com/document/product/460/30109 17 | $result = $cosClient->getCiService(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getDescribeDocProcessBuckets.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | // 查询文档预览开通状态 https://cloud.tencent.com/document/product/460/46945 18 | $result = $cosClient->describeDocProcessBuckets(array( 19 | 'Regions' => '', // 可选 地域信息,例如 ap-shanghai、ap-beijing,若查询多个地域以“,”分隔字符串 20 | 'BucketNames' => '', // 可选 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索 21 | 'BucketName' => '', // 可选 存储桶名称前缀,前缀搜索 22 | 'PageNumber' => 1, // 可选 第几页 23 | 'PageSize' => 20, // 可选 每页个数 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/getDescribeDocProcessJob.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->describeDocProcessJob(array( 17 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'examplejobid', // JobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDescribeDocProcessQueues.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->describeDocProcessQueues(array( 17 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getDescribeMediaBuckets.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | $result = $cosClient->describeMediaBuckets(array( 18 | 'Regions' => '', // 可选 地域信息,例如 ap-shanghai、ap-beijing,若查询多个地域以“,”分隔字符串 19 | 'BucketNames' => '', // 可选 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索 20 | 'BucketName' => '', // 可选 存储桶名称前缀,前缀搜索 21 | 'PageNumber' => 1, // 可选 第几页 22 | 'PageSize' => 20, // 可选 每页个数 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/getDescribeMediaQueues.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | // https://cloud.tencent.com/document/product/436/54045 搜索媒体处理队列 18 | $result = $cosClient->describeMediaQueues(array( 19 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 20 | // 'QueueIds' => '', // 可选 队列 ID,以“,”符号分割字符串 21 | // 'Category' => 'Transcoding', // 可选 CateAll:所有类型;Transcoding:媒体处理队列;SpeedTranscoding:媒体处理倍速转码队列;默认为 Transcoding。 22 | // 'State' => 'Paused', // 可选 1. Active 表示队列内的作业会被媒体转码服务调度转码执行 2. Paused 表示队列暂停,作业不再会被媒体转码调度转码执行,队列内的所有作业状态维持在暂停状态,已经处于转码中的任务将继续转码,不受影响 23 | // 'PageNumber' => '1', // 可选 第几页 24 | // 'PageSize' => '2', // 可选 每页个数 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/getDescribeMediaVoiceSeparateJob.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->describeMediaVoiceSeparateJob(array( 17 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'examplejobid', // JobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDetectAudioResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getDetectAudioResult(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDetectDocumentResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getDetectDocumentResult(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDetectImageResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getDetectImageResult(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDetectTextResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getDetectTextResult(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDetectVideoResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getDetectVideoResult(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDetectVirusResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getDetectVirusResult(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getDetectWebpageResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 审核时必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getDetectWebpageResult(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // jobId 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/getFileCompressResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/83113 查询多文件打包压缩结果 17 | $result = $cosClient->getFileCompressResult(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // jobId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/getFileHashCodeResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/83109 查询哈希值计算结果 17 | $result = $cosClient->getFileHashCodeResult(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // jobId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/getFileProcessQueueList.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 搜索文件处理队列 17 | $result = $cosClient->getFileProcessQueueList(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | // 'QueueIds' => '', // 队列 ID,以“,”符号分割字符串 20 | // 'State' => 'Active', // Active 表示队列内的作业会被调度执行; Paused 表示队列暂停 21 | // 'PageNumber' => '1', // 第几页,默认值1 22 | // 'PageSize' => '10', // 每页个数,默认值10 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/getFileUncompressResult.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 查询文件解压结果 17 | $result = $cosClient->getFileUncompressResult(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // jobId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/getHotLink.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 查询防盗链 https://cloud.tencent.com/document/product/460/30115 17 | $result = $cosClient->getHotLink(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getImageSlim.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getImageSlim(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | print_r($result); 20 | } catch (\Exception $e) { 21 | // 请求失败 22 | echo($e); 23 | } 24 | -------------------------------------------------------------------------------- /sample/getLiveCode.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 获取数字验证码 https://cloud.tencent.com/document/product/460/48647 17 | $result = $cosClient->getLiveCode(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getMediaInfo.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | $result = $cosClient->GetMediaInfo( 18 | array( 19 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 20 | 'Key' =>'exampleobject', //桶中的媒体文件,如test.mp4 21 | 'ci-process' => 'videoinfo' //操作类型,固定使用 videoinfo 22 | ) 23 | ); 24 | // 请求成功 25 | echo($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/getObject.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->getObject(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'SaveAs' => '/data/exampleobject', 20 | /* 21 | 'Range' => 'bytes=0-10', 22 | 'ResponseCacheControl' => 'string', 23 | 'ResponseContentDisposition' => 'string', 24 | 'ResponseContentEncoding' => 'string', 25 | 'ResponseContentLanguage' => 'string', 26 | 'ResponseContentType' => 'string', 27 | 'ResponseExpires' => 'string', 28 | */ 29 | )); 30 | // 请求成功 31 | print_r($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/getObjectTagging.php: -------------------------------------------------------------------------------- 1 | $region, 10 | 'scheme' => 'https', //协议头部,默认为http 11 | 'credentials' => array( 12 | 'secretId' => $secretId, 13 | 'secretKey' => $secretKey))); 14 | try { 15 | $result = $cosClient->getObjectTagging(array( 16 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 17 | 'Key' => 'exampleobject' 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getObjectUrl.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey 15 | ) 16 | ) 17 | ); 18 | $local_path = "/data/exampleobject"; 19 | 20 | try { 21 | $bucket = "examplebucket-1250000000"; //存储桶,存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 22 | $key = "exampleobject"; //对象在存储桶中的位置,即对象键 23 | $signedUrl = $cosClient->getObjectUrl( 24 | $bucket, 25 | $key, 26 | '+10 minutes', //签名的有效时间 27 | [ 28 | 'ResponseContentDisposition' => '111', 29 | 'Params' => [ // Params中可以传自定义querystring 30 | 'aaa' => 'bbb', 31 | 'ccc' => 'ddd' 32 | ], 33 | ] 34 | ); 35 | // 请求成功 36 | echo $signedUrl; 37 | } catch (\Exception $e) { 38 | // 请求失败 39 | print_r($e); 40 | } 41 | -------------------------------------------------------------------------------- /sample/getObjectWithoutSign.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | $bucket = 'examplebucket-125000000'; //存储桶,存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | $key = "exampleobject"; //对象在存储桶中的位置,即对象键 19 | $signedUrl = $cosClient -> getObjectUrlWithoutSign($bucket, $key); 20 | 21 | // 请求成功 22 | echo $signedUrl; 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | print_r($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/getOriginProtect.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 查询原图保护状态 https://cloud.tencent.com/document/product/460/30120 17 | $result = $cosClient->getOriginProtect(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/getPicBucketList.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须用https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | // 查询图片处理服务状态 18 | $result = $cosClient->getPicBucketList(array( 19 | // 'Regions' => '', // 可选 地域信息,例如 ap-shanghai、ap-beijing,若查询多个地域以“,”分隔字符串 20 | // 'BucketNames' => '', // 可选 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索 21 | // 'BucketName' => '', // 可选 存储桶名称前缀,前缀搜索 22 | // 'PageNumber' => 1, // 可选 第几页 23 | // 'PageSize' => 20, // 可选 每页个数 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/getPicQueueList.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须为https 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 搜索图片处理队列 https://cloud.tencent.com/document/product/460/79395 17 | $result = $cosClient->getPicQueueList(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | // 'QueueIds' => 'xxx', // 队列 ID,以“,”符号分割字符串 20 | // 'State' => 'Active', // Active 表示队列内的作业会被媒体处理服务调度执行, Paused 表示队列暂停,作业不再会被媒体处理调度执行,队列内的所有作业状态维持在暂停状态,已经执行中的任务不受影响 21 | // 'PageNumber' => '1', // 第几页 22 | // 'PageSize' => '10', // 每页个数 23 | )); 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | } 29 | -------------------------------------------------------------------------------- /sample/getPresignedUrl.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $signedUrl = $cosClient->getPresignedUrl( 17 | $method='getObject', 18 | $args=array( 19 | 'Bucket'=>'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 20 | 'Key'=>'exampleobject', 21 | 'Body'=>'', 22 | 'Params'=>array(), 23 | 'Headers'=>array()), //若上传加入headers,content-md5写法为"content-md5" => base64_encode( md5( Body, true ) ) 24 | $expires='+30 minutes'); 25 | // 请求成功 26 | echo($signedUrl); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/getPrivateM3U8.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | $result = $cosClient->GetPrivateM3U8(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => 'xxx.m3u8', // 桶文件 20 | 'ci-process' => 'pm3u8', // 操作类型,固定使用 pm3u8 21 | 'expires' => '3600', // 私有 ts 资源 url 下载凭证的相对有效期,单位为秒,范围为[3600, 43200] 22 | )); 23 | // 请求成功 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | } 29 | -------------------------------------------------------------------------------- /sample/getWorkflowInstance.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 默认http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/53992 获取工作流实例详情 17 | $result = $cosClient->getWorkflowInstance(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // RunId 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/getWorkflowInstances.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 默认http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/53993 获取工作流实例列表 17 | $result = $cosClient->getWorkflowInstances(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'workflowId' => 'w9938ed4b1435448783xxxxxxxxxxxxxx', 20 | // 'name' => '', 21 | // 'orderByTime' => '', 22 | // 'size' => '', 23 | // 'states' => '', 24 | // 'startCreationTime' => '', 25 | // 'endCreationTime' => '', 26 | // 'nextToken' => '', 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo($e); 33 | } 34 | -------------------------------------------------------------------------------- /sample/headBucket.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->headBucket(array( 17 | 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/headObject.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->headObject(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/imageAssessQualityProcess.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 图片质量评估 - https://cloud.tencent.com/document/product/460/63228 17 | $result = $cosClient->imageAssessQualityProcess(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => 'exampleobject', 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/imageAve.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->ImageAve(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/imageDetectCarProcess.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 车辆车牌检测 - https://cloud.tencent.com/document/product/460/63225 17 | $result = $cosClient->imageDetectCarProcess(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => 'exampleobject', 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/imageDetectFace.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 人脸检测 https://cloud.tencent.com/document/product/460/63223 17 | $result = $cosClient->imageDetectFace(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // ObjectKey 20 | // 'MaxFaceNum' => 1, // 最多处理的人脸数目。默认值为1(仅检测图片中面积最大的那张人脸),最大值为120。此参数用于控制处理待检测图片中的人脸个数,值越小,处理速度越快。 21 | )); 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/imageExif.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->ImageExif(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/imageInfo.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->ImageInfo(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/imageMogr.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate(); 17 | $imageMogrTemplate->thumbnailByScale(50); 18 | $imageMogrTemplate->rotate(50); 19 | $result = $cosClient->getObject(array( 20 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 21 | 'Key' => 'exampleobject', 22 | 'ImageHandleParam' => $imageMogrTemplate->queryString(), 23 | 'SaveAs' => '/data/exampleobject', 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/imageProcess.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate(); 17 | $imageMogrTemplate->thumbnailByScale(50); 18 | $picOperationsTemplate = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation(); 19 | $picOperationsTemplate->setIsPicInfo(1); 20 | $picOperationsTemplate->addRule($imageMogrTemplate, "resultobject"); 21 | $result = $cosClient->ImageProcess(array( 22 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 23 | 'Key' => 'exampleobject', 24 | 'PicOperations' => $picOperationsTemplate->queryString(), 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/imageView.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $imageViewTemplate = new Qcloud\Cos\ImageParamTemplate\ImageViewTemplate(); 17 | $imageViewTemplate->setMode(1); 18 | $imageViewTemplate->setWidth(400); 19 | $imageViewTemplate->setHeight(600); 20 | $imageViewTemplate->setQuality(1, 85); 21 | $result = $cosClient->getObject(array( 22 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 23 | 'Key' => 'exampleobject', 24 | 'ImageHandleParam' => $imageViewTemplate->queryString(), 25 | 'SaveAs' => '/data/exampleobject' 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/listBuckets.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | $result = $cosClient->listBuckets(); 18 | // 请求成功 19 | print_r($result); 20 | } catch (\Exception $e) { 21 | // 请求失败 22 | echo($e); 23 | } 24 | -------------------------------------------------------------------------------- /sample/listMultipartUploads.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->listMultipartUploads(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Delimiter' => '/', 19 | 'EncodingType' => 'url', 20 | 'KeyMarker' => 'string', 21 | 'UploadIdMarker' => 'string', 22 | 'Prefix' => 'prfix', 23 | 'MaxUploads' => 1000, 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/listObjects.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->listObjects(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Delimiter' => '/', //Delimiter表示分隔符, 设置为/表示列出当前目录下的object, 设置为空表示列出所有的object 19 | 'EncodingType' => 'url',//编码格式,对应请求中的 encoding-type 参数 20 | 'Marker' => 'prefix/picture.jpg',//起始对象键标记 21 | 'Prefix' => 'prfix/', //Prefix表示列出的object的key以prefix开始 22 | 'MaxKeys' => 1000, // 设置最大遍历出多少个对象, 一次listObjects最大支持1000 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/listParts.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->listParts(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'UploadId' => 'NWNhNDY0YzFfMmZiNTM1MGFfNTM2YV8xYjliMTg', 20 | 'PartNumberMarker' => 1, 21 | 'MaxParts' => 1000, 22 | )); 23 | // 请求成功 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | } 29 | -------------------------------------------------------------------------------- /sample/livenessRecognitionProcess.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 活体人脸核身 待补充 17 | } catch (\Exception $e) { 18 | // 请求失败 19 | echo($e); 20 | } 21 | -------------------------------------------------------------------------------- /sample/openAiService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须用https 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 开通 AI 内容识别 https://cloud.tencent.com/document/product/460/79593 17 | $result = $cosClient->openAiService(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/openAsrService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须用https 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 开通智能语音服务 https://cloud.tencent.com/document/product/460/95754 17 | $result = $cosClient->openAsrService(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/openFileProcessService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 开通文件处理服务 17 | $result = $cosClient->openFileProcessService(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/openImageSlim.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->openImageSlim(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'SlimMode' => 'API', 19 | 'Suffixs' => array( 20 | 'Suffix' => array( 21 | 'jpg', 22 | 'png', 23 | ), 24 | ), 25 | )); 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/openOriginProtect.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 开通原图保护 https://cloud.tencent.com/document/product/460/30121 17 | $result = $cosClient->openOriginProtect(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/putBucketAccelerate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putBucketAccelerate(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Status' => 'Enabled' 19 | )); 20 | // 请求成功 21 | print_r($result); 22 | } catch (\Exception $e) { 23 | // 请求失败 24 | echo($e); 25 | } 26 | -------------------------------------------------------------------------------- /sample/putBucketCors.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putBucketCors(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'CORSRules' => array( 19 | array( 20 | 'ID' => '1234', 21 | 'AllowedHeaders' => array('*'), 22 | 'AllowedMethods' => array('PUT'), 23 | 'AllowedOrigins' => array('http://www.qq.com'), 24 | ), 25 | ), 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo "$e\n"; 32 | } 33 | -------------------------------------------------------------------------------- /sample/putBucketDomain.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putBucketDomain(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'DomainRules' => array( 19 | array( 20 | 'Name' => 'www.qq.com', 21 | 'Status' => 'ENABLED', 22 | 'Type' => 'REST', 23 | 'ForcedReplacement' => 'CNAME', 24 | ), 25 | // ... repeated 26 | ), 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo "$e\n"; 33 | } 34 | -------------------------------------------------------------------------------- /sample/putBucketGuetzli.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->PutBucketGuetzli(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | )); 19 | // 请求成功 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/putBucketImageStyle.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->PutBucketImageStyle(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'StyleName' => 'stylename', 19 | 'StyleBody' => 'imageMogr2/thumbnail/!50px', 20 | )); 21 | // 请求成功 22 | print_r($result); 23 | } catch (\Exception $e) { 24 | // 请求失败 25 | echo($e); 26 | } 27 | -------------------------------------------------------------------------------- /sample/putBucketLogging.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putBucketLogging(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'LoggingEnabled' => array( 19 | 'TargetBucket' => 'examplebucket2-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 20 | 'TargetPrefix' => '', 21 | ) 22 | )); 23 | // 请求成功 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo "$e\n"; 28 | } 29 | -------------------------------------------------------------------------------- /sample/putBucketReferer.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putBucketReferer( 17 | array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Status' => 'Enabled', //是否开启防盗链,枚举值:Enabled、Disabled 20 | 'RefererType' => 'White-List', //防盗链类型,枚举值:Black-List、White-List 21 | 'DomainList' => array( 22 | 'Domains' => array( 23 | '*.qq.com', 24 | '*.qcloud.com', 25 | ) 26 | ), //生效域名列表 27 | // 'EmptyReferConfiguration' => 'Allow',//是否允许空 Referer 访问,枚举值:Allow、Deny,默认值为 Deny 28 | ) 29 | ); 30 | // 请求成功 31 | echo($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/putBucketTagging.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putBucketTagging(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'TagSet' => array( 19 | array('Key'=>'key1', 20 | 'Value'=>'value1', 21 | ), 22 | array('Key'=>'key2', 23 | 'Value'=>'value2', 24 | ), 25 | ), 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo "$e\n"; 32 | } 33 | -------------------------------------------------------------------------------- /sample/putObjectTagging.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->putObjectTagging(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'TagSet' => array( 20 | array('Key'=>'key1', 21 | 'Value'=>'value1', 22 | ), 23 | array('Key'=>'key2', 24 | 'Value'=>'value2', 25 | ), 26 | ), 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo "$e\n"; 33 | } 34 | -------------------------------------------------------------------------------- /sample/qrcodeGenerate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 二维码生成 17 | $result = $cosClient->QrcodeGenerate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'QrcodeContent' => '', 20 | 'QrcodeMode' => 0, 21 | 'QrcodeWidth' => '200', 22 | )); 23 | // 请求成功 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | } 29 | -------------------------------------------------------------------------------- /sample/restoreObject.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->restoreObject(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'Days' => integer, 20 | 'CASJobParameters' => array( 21 | 'Tier' =>'string' 22 | ) 23 | )); 24 | // 请求成功 25 | print_r($result); 26 | } catch (\Exception $e) { 27 | // 请求失败 28 | echo($e); 29 | } 30 | -------------------------------------------------------------------------------- /sample/textWatermark.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $textWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\TextWatermarkTemplate(); 17 | $textWatermarkTemplate->setText("testetst"); 18 | $textWatermarkTemplate->setGravity('center'); 19 | $textWatermarkTemplate->setFontsize(30); 20 | $result = $cosClient->getObject(array( 21 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 22 | 'Key' => 'exampleobject', 23 | 'ImageHandleParam' => $textWatermarkTemplate->queryString(), 24 | 'SaveAs' => '/data/exampleobject' 25 | )); 26 | // 请求成功 27 | print_r($result); 28 | } catch (\Exception $e) { 29 | // 请求失败 30 | echo($e); 31 | } 32 | -------------------------------------------------------------------------------- /sample/triggerWorkflow.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 默认http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/54641 手动触发工作流 17 | $result = $cosClient->triggerWorkflow(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'workflowId' => 'w9938ed4b1435448783xxxxxxxxxxxxxx', 20 | 'object' => 'test01.png', 21 | // 'name' => 'xxx', 22 | )); 23 | // 请求成功 24 | print_r($result); 25 | } catch (\Exception $e) { 26 | // 请求失败 27 | echo($e); 28 | } 29 | -------------------------------------------------------------------------------- /sample/unBindCiService.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials' => array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 解绑数据万象服务 https://cloud.tencent.com/document/product/460/30110 17 | $result = $cosClient->unBindCiService(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | )); 20 | print_r($result); 21 | } catch (\Exception $e) { 22 | // 请求失败 23 | echo($e); 24 | } 25 | -------------------------------------------------------------------------------- /sample/updateAiQueue.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新 AI 内容识别队列 https://cloud.tencent.com/document/product/460/79397 17 | $result = $cosClient->updateAiQueue(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // queueId 20 | 'Name' => 'queue-ai-process', 21 | 'State' => 'Active', 22 | 'NotifyConfig' => array( 23 | 'State' => 'Off', 24 | // 'Event' => '', 25 | // 'ResultFormat' => '', 26 | // 'Type' => '', 27 | // 'Url' => '', 28 | // 'MqMode' => '', 29 | // 'MqRegion' => '', 30 | // 'MqName' => '', 31 | ), 32 | )); 33 | // 请求成功 34 | print_r($result); 35 | } catch (\Exception $e) { 36 | // 请求失败 37 | echo($e); 38 | } 39 | -------------------------------------------------------------------------------- /sample/updateAsrQueue.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新智能语音队列 https://cloud.tencent.com/document/product/460/46235 17 | $result = $cosClient->updateAsrQueue(array( 18 | 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // queueId 20 | 'Name' => 'queue-smart-audio', 21 | 'State' => 'Active', 22 | 'NotifyConfig' => array( 23 | 'State' => 'Off', 24 | // 'Event' => '', 25 | // 'ResultFormat' => '', 26 | // 'Type' => '', 27 | // 'Url' => '', 28 | // 'MqMode' => '', 29 | // 'MqRegion' => '', 30 | // 'MqName' => '', 31 | ), 32 | )); 33 | // 请求成功 34 | print_r($result); 35 | } catch (\Exception $e) { 36 | // 请求失败 37 | echo($e); 38 | } 39 | -------------------------------------------------------------------------------- /sample/updateDocProcessQueue.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新文档转码队列 https://cloud.tencent.com/document/product/460/46947 17 | $result = $cosClient->updateDocProcessQueue(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // QueueID 20 | 'Name' => '', 21 | 'QueueID' => '', 22 | 'State' => '', 23 | 'NotifyConfig' => array( 24 | 'Url' => '', 25 | 'Type' => '', 26 | 'Event' => '', 27 | 'State' => '', 28 | ), 29 | )); 30 | // 请求成功 31 | print_r($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/updateMediaNoiseReductionTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新音频降噪模板 https://cloud.tencent.com/document/product/460/94394 17 | $result = $cosClient->updateMediaNoiseReductionTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // TemplateId 20 | 'Tag' => 'NoiseReduction', 21 | 'Name' => 'NoiseReduction-Template', 22 | 'NoiseReduction' => array( 23 | 'Format' => 'wav', 24 | 'Samplerate' => '16000', 25 | ), 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/updateMediaPicProcessTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/67228 更新图片处理模板 17 | $result = $cosClient->updateMediaPicProcessTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // TemplateId 20 | 'Tag' => 'PicProcess', 21 | 'Name' => 'PicProcess-Template-Name', 22 | 'PicProcess' => array( 23 | 'IsPicInfo' => '', 24 | 'ProcessRule' => 'imageMogr2/rotate/90', 25 | ), 26 | )); 27 | // 请求成功 28 | print_r($result); 29 | } catch (\Exception $e) { 30 | // 请求失败 31 | echo($e); 32 | } 33 | -------------------------------------------------------------------------------- /sample/updateMediaQueue.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | 16 | try { 17 | // https://cloud.tencent.com/document/product/436/54046 更新媒体处理队列 18 | $result = $cosClient->updateMediaQueue(array( 19 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 20 | 'Key' => 'xxx', // queueId 21 | 'Name' => '', // 模板名称, 长度限制100字符 22 | 'State' => 'Active', // 管道状态 23 | 'NotifyConfig' => array( 24 | 'State' => 'Off', 25 | // 'Event' => '', 26 | // 'ResultFormat' => '', 27 | // 'Type' => '', 28 | // 'Url' => '', 29 | // 'MqMode' => '', 30 | // 'MqRegion' => '', 31 | // 'MqName' => '', 32 | ), 33 | )); 34 | // 请求成功 35 | print_r($result); 36 | } catch (\Exception $e) { 37 | // 请求失败 38 | echo($e); 39 | } 40 | -------------------------------------------------------------------------------- /sample/updateMediaSmartCoverTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须使用https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新智能封面模板 https://cloud.tencent.com/document/product/460/84755 17 | $result = $cosClient->updateMediaSmartCoverTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // TemplateId 20 | 'Tag' => 'SmartCover', 21 | 'Name' => 'media-smartcover-name', 22 | 'SmartCover' => array( 23 | 'Format' => 'jpg', 24 | 'Width' => '1280', 25 | 'Height' => '960', 26 | 'Count' => '3', 27 | 'DeleteDuplicates' => 'true', 28 | ), 29 | )); 30 | // 请求成功 31 | print_r($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/updateMediaSnapshotTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/54032 更新截图模板 17 | $result = $cosClient->updateMediaSnapshotTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // TemplateId 20 | 'Tag' => 'Snapshot', 21 | 'Name' => 'Snapshot-Template-Name', 22 | 'Snapshot' => array( 23 | 'Mode' => '', 24 | 'Start' => '', 25 | 'TimeInterval' => '', 26 | 'Count' => '', 27 | 'Width' => '', 28 | 'Height' => '', 29 | ), 30 | )); 31 | // 请求成功 32 | print_r($result); 33 | } catch (\Exception $e) { 34 | // 请求失败 35 | echo($e); 36 | } 37 | -------------------------------------------------------------------------------- /sample/updateMediaSuperResolutionTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->updateMediaSuperResolutionTemplate(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // TemplateId 19 | 'Tag' => 'SuperResolution', 20 | 'Name' => 'SuperResolution-Template-Name', 21 | 'Resolution' => '', 22 | 'EnableScaleUp' => '', 23 | 'Version' => '', 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /sample/updateMediaTargetRecTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新视频目标检测模板 17 | $result = $cosClient->updateMediaTargetRecTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // TemplateId 20 | 'Tag' => 'VideoTargetRec', 21 | 'Name' => 'template-name', 22 | 'VideoTargetRec' => array( 23 | 'Body' => 'true', 24 | 'Pet' => 'true', 25 | 'Car' => 'false', 26 | ), // Body、Pet、Car 不能同时为 false 27 | )); 28 | // 请求成功 29 | print_r($result); 30 | } catch (\Exception $e) { 31 | // 请求失败 32 | echo($e); 33 | } 34 | -------------------------------------------------------------------------------- /sample/updateMediaVideoProcessTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->updateMediaVideoProcessTemplate(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => '', // TemplateId 19 | 'Tag' => 'VideoProcess', 20 | 'Name' => 'VideoProcess-Template-Name', 21 | 'ColorEnhance' => array( 22 | 'Enable' => '', 23 | 'Contrast' => '', 24 | 'Correction' => '', 25 | 'Saturation' => '', 26 | ), 27 | 'MsSharpen' => array( 28 | 'Enable' => '', 29 | 'SharpenLevel' => '', 30 | ), 31 | )); 32 | // 请求成功 33 | print_r($result); 34 | } catch (\Exception $e) { 35 | // 请求失败 36 | echo($e); 37 | } 38 | -------------------------------------------------------------------------------- /sample/updateMediaVoiceSeparateTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // https://cloud.tencent.com/document/product/436/58318 更新人声分离模板 17 | $result = $cosClient->updateMediaVoiceSeparateTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // TemplateId 20 | 'Tag' => 'VoiceSeparate', 21 | 'Name' => 'VoiceSeparate-Template-Name', 22 | 'AudioMode' => 'IsAudio', 23 | 'AudioConfig' => array( 24 | 'Codec' => 'aac', 25 | 'Samplerate' => '', 26 | 'Bitrate' => '', 27 | 'Channels' => '', 28 | ), 29 | )); 30 | // 请求成功 31 | print_r($result); 32 | } catch (\Exception $e) { 33 | // 请求失败 34 | echo($e); 35 | } 36 | -------------------------------------------------------------------------------- /sample/updatePicQueue.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须为https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新图片处理队列 https://cloud.tencent.com/document/product/460/79396 17 | $result = $cosClient->updatePicQueue(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // queueId 20 | 'Name' => 'queue-pic-process', 21 | 'State' => 'Active', 22 | 'NotifyConfig' => array( 23 | 'State' => 'Off', 24 | // 'Event' => '', 25 | // 'ResultFormat' => '', 26 | // 'Type' => '', 27 | // 'Url' => '', 28 | // 'MqMode' => '', 29 | // 'MqRegion' => '', 30 | // 'MqName' => '', 31 | ), 32 | )); 33 | // 请求成功 34 | print_r($result); 35 | } catch (\Exception $e) { 36 | // 请求失败 37 | echo($e); 38 | } 39 | -------------------------------------------------------------------------------- /sample/updateVoiceTtsTemplate.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', // 万象接口必须使用https 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | // 更新语音合成模板 https://cloud.tencent.com/document/product/460/84758 17 | $result = $cosClient->updateVoiceTtsTemplate(array( 18 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 19 | 'Key' => '', // TemplateId 20 | 'Tag' => 'Tts', 21 | 'Name' => 'TemplateName', 22 | 'Mode' => 'Sync', 23 | 'Codec' => 'pcm', 24 | 'VoiceType' => 'aixiaoxing', 25 | 'Volume' => '2', 26 | 'Speed' => '200', 27 | 'Emotion' => 'arousal', 28 | )); 29 | // 请求成功 30 | print_r($result); 31 | } catch (\Exception $e) { 32 | // 请求失败 33 | echo($e); 34 | } 35 | -------------------------------------------------------------------------------- /sample/uploadPart.php: -------------------------------------------------------------------------------- 1 | $region, 11 | 'scheme' => 'https', //协议头部,默认为http 12 | 'credentials'=> array( 13 | 'secretId' => $secretId, 14 | 'secretKey' => $secretKey))); 15 | try { 16 | $result = $cosClient->uploadPart(array( 17 | 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket 18 | 'Key' => 'exampleobject', 19 | 'Body' => 'string', 20 | 'UploadId' => 'NWNhNDY0YzFfMmZiNTM1MGFfNTM2YV8xYjliMTg', 21 | 'PartNumber' => 1, 22 | 'ContentMD5' => 'string', 23 | 'ContentLength' => 100, 24 | )); 25 | // 请求成功 26 | print_r($result); 27 | } catch (\Exception $e) { 28 | // 请求失败 29 | echo($e); 30 | } 31 | -------------------------------------------------------------------------------- /src/Exception/CosException.php: -------------------------------------------------------------------------------- 1 | spilt = $spilt; 14 | $this->tranParams = array(); 15 | $this->tranString = ""; 16 | } 17 | 18 | public function addRule(ImageTemplate $template) { 19 | if($template->queryString()){ 20 | $this->tranParams[] = $template->queryString(); 21 | } 22 | } 23 | 24 | public function queryString() { 25 | if($this->tranParams) { 26 | $this->tranString = implode($this->spilt, $this->tranParams); 27 | } 28 | return $this->tranString; 29 | } 30 | 31 | public function resetRule() { 32 | $this->tranParams = array(); 33 | $this->tranString = ""; 34 | } 35 | 36 | public function defineRule($value) { 37 | $this->tranParams[] = $value; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ImageParamTemplate/CIProcessTransformation.php: -------------------------------------------------------------------------------- 1 | tranParams['ci-process'] = $ciProcess; 13 | $this->tranString = ""; 14 | } 15 | 16 | public function addParam($name, $value, $base64 = false) { 17 | if(is_string($name) && strlen($name) > 0){ 18 | if($base64) { 19 | $value = $this->ciBase64($value); 20 | } 21 | $this->tranParams[$name] = $value; 22 | } 23 | } 24 | 25 | public function queryString() { 26 | if($this->tranParams) { 27 | $this->tranString = http_build_query($this->tranParams); 28 | } 29 | return $this->tranString; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ImageParamTemplate/ImageSlimTemplate.php: -------------------------------------------------------------------------------- 1 | style = ""; 12 | } 13 | 14 | public function setStyle($styleName) { 15 | $this->style = "style/" . $styleName; 16 | } 17 | 18 | public function getStyle() { 19 | return $this->style; 20 | } 21 | 22 | public function queryString() { 23 | $res = ""; 24 | if($this->style) { 25 | $res = $this->style; 26 | } 27 | return $res; 28 | } 29 | 30 | public function resetRule() { 31 | $this->style = ""; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ImageParamTemplate/ImageTemplate.php: -------------------------------------------------------------------------------- 1 | startElementNS($prefix, $name, $namespace); 13 | } else { 14 | $writer->startElement($name); 15 | } 16 | // Remove use writeCdata 17 | $writer->writeRaw($value); 18 | $writer->endElement(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/SignatureMiddleware.php: -------------------------------------------------------------------------------- 1 | nextHandler = $nextHandler; 16 | $this->signature = new Signature($accessKey, $secretKey, $options); 17 | } 18 | 19 | public function __invoke(RequestInterface $request, array $options) { 20 | $fn = $this->nextHandler; 21 | return $fn($this->signature->signRequest($request), $options); 22 | } 23 | } 24 | --------------------------------------------------------------------------------