-
Notifications
You must be signed in to change notification settings - Fork 2
/
alarm-api-example.php
41 lines (32 loc) · 985 Bytes
/
alarm-api-example.php
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
<?php
const TRIGGER_URL = 'https://api.blaulichtsms.net/blaulicht/api/alarm/v1/trigger';
const CUSTOMER_ID = '';
const USERNAME = '';
const PASSWORD = '';
const ADDITIONAL_MSISDNS = ['+43660123456789'];
const GROUPS = ['G1'];
const TEXT = 'Das ist ein test der API';
$request_body = [
'username' => USERNAME,
'password' => PASSWORD,
'hideTriggerDetails' => false,
'customerId' => CUSTOMER_ID,
'alarmText' => TEXT,
'type' => 'alarm',
'needsAcknowledgement' => true,
'duration' => 60,
'template' => '',
'groupCodes' => GROUPS,
'additionalMsisdns' => ADDITIONAL_MSISDNS
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, TRIGGER_URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request_body));
$curlResponse = curl_exec($ch);
curl_close($ch);
print_r($curlResponse);