Browse code

added appinfo/info.xml appinfo/signature.json CHANGELOG.txt lib/AppInfo/Application.php css/style.css providers/Plivo

DoubleBastionAdmin authored on 05/11/2025 13:35:09
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,112 @@
1
+<?php
2
+
3
+
4
+require 'vendor/autoload.php';
5
+
6
+use Plivo\RestClient;
7
+use Plivo\Exceptions\PlivoRestException;
8
+
9
+
10
+$AUTH_ID = "AUTH_ID";
11
+$AUTH_TOKEN = "AUTH_TOKEN";
12
+
13
+$client = new RestClient($AUTH_ID, $AUTH_TOKEN);
14
+$client->client->setTimeout(40);
15
+
16
+// Create LOA
17
+echo "########## CREATE LOA ###################\n";
18
+try {
19
+    $file = 'file_path';
20
+    $alias = 'alias';
21
+    $response = $client->hostedMessageLOA->create($alias, $file);
22
+    print_r($response);
23
+} catch (PlivoRestException $ex) {
24
+    print_r($ex);
25
+}
26
+
27
+// List LOA
28
+echo "########## List LOA ###################\n";
29
+try {
30
+    $params = array(
31
+        'limit' => 10,
32
+        'offset' => 0,
33
+        'alias' => "alias"
34
+    );
35
+    $response = $client->hostedMessageLOA->list($params);
36
+    foreach ($response->resources as $res) {
37
+        print_r($res->properties);    
38
+    }
39
+} catch (PlivoRestException $ex) {
40
+    print_r($ex);
41
+}
42
+
43
+
44
+// Get LOA by loaID
45
+echo "########## Get LOA ###################\n";
46
+try {
47
+    $response = $client->hostedMessageLOA->get(
48
+      "loaId"
49
+    );
50
+
51
+    print_r($response->properties);
52
+} catch (PlivoRestException $ex) {
53
+    print_r($ex);
54
+}
55
+
56
+
57
+// DELETE LOA by loaID
58
+echo "########## DELETE LOA ###################\n";
59
+try {
60
+    $client->hostedMessageLOA->delete(
61
+        "hostedMessageLOAId"
62
+    );
63
+   
64
+} catch (PlivoRestException $ex) {
65
+    print_r($ex);
66
+}
67
+
68
+// List HostedMessagingNumber
69
+echo "########## List HostedMessagingNumber ###################\n";
70
+try {
71
+    $params = array(
72
+        'limit' => 1,
73
+        'offset' => 0,
74
+        'hosted_status' => 'disconnected',
75
+        'number' => 'number',
76
+        'loa_id' => 'loa_id',
77
+        'alias' => 'alias'
78
+    );
79
+    $response = $client->hostedMessagingNumber->list($params);
80
+    foreach ($response->resources as $res) {
81
+        print_r($res->properties);    
82
+    }
83
+} catch (PlivoRestException $ex) {
84
+    print_r($ex);
85
+}
86
+
87
+
88
+// Create HostedMessagingNumber
89
+echo "########## CREATE HostedMessagingNumber ###################\n";
90
+try {
91
+   
92
+    $alias = 'alias';
93
+    $appId = "appid";
94
+    $loaId = "loaID";
95
+    $number = "number";
96
+    $response = $client->hostedMessagingNumber->create($alias, $loaId,$appId,$number);
97
+    print_r($response);
98
+} catch (PlivoRestException $ex) {
99
+    print_r($ex);
100
+}
101
+
102
+
103
+// Get HostedMessagingNumber by hostedMessagingNumberID
104
+echo "########## Get HostedMessagingNumber ###################\n";
105
+try {
106
+    $response = $client->hostedMessagingNumber->get(
107
+        "hostedMessagingOrderID"
108
+    );
109
+    print_r($response->properties);
110
+} catch (PlivoRestException $ex) {
111
+    print_r($ex);
112
+}