example.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once("../../autoload.php");
use \Qiniu\Auth;
$ak="xxxx";
$sk="xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Sms\Sms($auth);
//发送信息模块
$template_id="1131792074274775040";
$mobiles=array("18011111111","18011111111");
$code = array('code' => 'code' );
try {
//发送短信
$resp = $client->sendMessage($template_id, $mobiles, $code);
print_r($resp);
} catch (\Exception $e) {
echo "Error:", $e, "\n";
}exit;
//模板模块
$name="tstest001";
$template="tesy001 ${code}";
$type="notification";
$description="tstest001";
$signature_id="1131464448834277376";
$id="1131810682442883072";
try {
//创建模板
$resp = $client->createTemplate($name, $template, $type, $description, $signature_id);
print_r($resp);
//查询模板
$resp = $client->queryTemplate();
print_r($resp);
//修改模板
$resp = $client->updateTemplate($id, $name, $template, $description, $signature_id);
print_r($resp);
//删除模板
$resp = $client->deleteTemplate($id);
print_r($resp);
} catch (\Exception $e) {
echo "Error:", $e, "\n";
}
//签名模块
$signature = 'lfxlive2';
$source = 'enterprises_and_institutions';
$pic="/Users/Desktop/sss.jpg";
$audit_status="passed";
$page=1;
$page_size=1;
$id="1131464448834277376";
try {
//创建签名
$resp = $client->createSignature($signature, $source, $pic);
print_r($resp);
//查询签名
$resp = $client->checkSignature($audit_status);
//修改签名
$resp = $client->updateSignature($id, $signature, $source, $pic);
print_r($resp);
//删除ID
$resp = $client->deleteSignature($id);
print_r($resp);
} catch (\Exception $e) {
echo "Error:", $e, "\n";
}