-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallow_contacking_consent.php
More file actions
44 lines (36 loc) · 1.06 KB
/
allow_contacking_consent.php
File metadata and controls
44 lines (36 loc) · 1.06 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
<?php
$accessToken = "ACCESS TOKEN";
$apiEndpoint = "https://pams.ai/xxxx/xxxx";
$data = [
"event" => "allow_consent",
"form_fields" => [
"_database" => "db-demo",
"_consent_message_id" => "2d4z4k....TUnluU2d",
"_version" => "latest",
"_allow_terms_and_conditions" => true,
"_allow_privacy_overview" => true,
"_allow_email" => true,
"_allow_sms" => true,
"_allow_line" => true,
"_allow_facebook_messenger" => true,
"_allow_push_notification" => true,
"customer" => "cus001"
]
];
$ch = curl_init($apiEndpoint);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: $accessToken",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
$responseData = json_decode($response, true);
print_r($responseData);
}
?>