Skip to content

Commit 1d8b7d8

Browse files
authored
云查毒 (#254)
* 云查毒 * 人声分离
1 parent 01e6fd5 commit 1d8b7d8

21 files changed

+1427
-14
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', //协议头部,默认为http
12+
'credentials'=> array(
13+
'secretId' => $secretId ,
14+
'secretKey' => $secretKey)));
15+
try {
16+
// start --------------- 使用模版 ----------------- //
17+
$result = $cosClient->createMediaVoiceSeparateJobs(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'VoiceSeparate',
20+
'QueueId' => '',
21+
'CallBack' => '',
22+
'Input' => array(
23+
'Object' => 'test.mp3'
24+
),
25+
'Operation' => array(
26+
'TemplateId' => '',
27+
'Output' => array(
28+
'Region' => $region,
29+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
30+
'Object' => 'VoiceSeparate01.mp3',
31+
'AuObject' => 'VoiceSeparate02.mp3',
32+
),
33+
),
34+
));
35+
// 请求成功
36+
print_r($result);
37+
// end --------------- 使用模版 ----------------- //
38+
39+
// start --------------- 自定义参数 ----------------- //
40+
$result = $cosClient->createMediaVoiceSeparateJobs(array(
41+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
42+
'Tag' => 'VoiceSeparate',
43+
'QueueId' => '',
44+
'CallBack' => '',
45+
'Input' => array(
46+
'Object' => 'test.mp3'
47+
),
48+
'Operation' => array(
49+
'Output' => array(
50+
'Region' => $region,
51+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
52+
'Object' => 'VoiceSeparate01.mp3',
53+
'AuObject' => 'VoiceSeparate02.mp3',
54+
),
55+
'VoiceSeparate' => array(
56+
'AudioMode' => 'AudioAndBackground',
57+
'AudioConfig' => array(
58+
'Codec' => 'mp3',
59+
'Samplerate' => '11025',
60+
'Bitrate' => '256',
61+
'Channels' => '2',
62+
),
63+
),
64+
),
65+
));
66+
// 请求成功
67+
print_r($result);
68+
// end --------------- 自定义参数 ----------------- //
69+
} catch (\Exception $e) {
70+
// 请求失败
71+
echo($e);
72+
}
73+

sample/detectAudio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
11-
'schema' => 'https', //协议头部,默认为http
11+
'schema' => 'https', // 审核时必须为https
1212
'credentials'=> array(
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));

sample/detectDocument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
11-
'schema' => 'https', //协议头部,默认为http
11+
'schema' => 'https', // 审核时必须为https
1212
'credentials'=> array(
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));

sample/detectImage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
11-
'schema' => 'https', //协议头部,默认为http
11+
'schema' => 'https', // 审核时必须为https
1212
'credentials' => array(
1313
'secretId' => $secretId,
1414
'secretKey' => $secretKey)));

sample/detectImages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
11-
'schema' => 'https', //协议头部,默认为http
11+
'schema' => 'https', // 审核时必须为https
1212
'credentials' => array(
1313
'secretId' => $secretId,
1414
'secretKey' => $secretKey)));

sample/detectText.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
11-
'schema' => 'https', //协议头部,默认为http
11+
'schema' => 'https', // 审核时必须为https
1212
'credentials'=> array(
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));
@@ -45,6 +45,23 @@
4545
// 请求成功
4646
print_r($result);
4747
// end --------------- 存储桶文本文件审核 ----------------- //
48+
49+
// start --------------- 文本文件Url审核 ----------------- //
50+
$result = $cosClient->detectText(array(
51+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
52+
'Input' => array(
53+
'Url' => 'http://example.com/test.txt'
54+
),
55+
'Conf' => array(
56+
'DetectType' => 'Porn,Terrorism,Politics,Ads',
57+
// 'Callback' => 'https://example.callback.com/test/', // 回调URL
58+
// 'CallbackVersion' => 'Detail',
59+
// 'BizType' => '',
60+
),
61+
));
62+
// 请求成功
63+
print_r($result);
64+
// end --------------- 文本文件Url审核 ----------------- //
4865
} catch (\Exception $e) {
4966
// 请求失败
5067
echo($e);

sample/detectVideo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
11-
'schema' => 'https', //协议头部,默认为http
11+
'schema' => 'https', // 审核时必须为https
1212
'credentials'=> array(
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));

sample/detectVirus.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', // 审核时必须为https
12+
'credentials'=> array(
13+
'secretId' => $secretId ,
14+
'secretKey' => $secretKey)));
15+
try {
16+
// 存储桶文件查毒
17+
$result = $cosClient->detectVirus(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Input' => array(
20+
'Object' => 'test01.exe'
21+
),
22+
'Conf' => array(
23+
'DetectType' => 'Virus',
24+
// 'Callback' => '',
25+
),
26+
));
27+
28+
// URL查毒
29+
$result = $cosClient->detectVirus(array(
30+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
31+
'Input' => array(
32+
'Url' => 'https://example.com/test01.exe',
33+
),
34+
'Conf' => array(
35+
'DetectType' => 'Virus',
36+
// 'Callback' => '',
37+
),
38+
));
39+
// 请求成功
40+
print_r($result);
41+
} catch (\Exception $e) {
42+
// 请求失败
43+
echo($e);
44+
}
45+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => '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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
11-
'schema' => 'https', //协议头部,默认为http
11+
'schema' => 'https', // 审核时必须为https
1212
'credentials'=> array(
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));

0 commit comments

Comments
 (0)