forked from Lutice/bbb-transcript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-getTranscript.php
More file actions
50 lines (36 loc) · 1.36 KB
/
test-getTranscript.php
File metadata and controls
50 lines (36 loc) · 1.36 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
<?php
$bbbSecret = '[BBB_SECRET_KEY]';
$meetingId='[BBB_MEETING_ID]'; // The meeting id you need to get transcript result
$serverURL='[HOOK_SERVER_URL]'; // The server url where script get_transcript run to serve the json result
function sendGetRequest($url, $params) {
$ch = curl_init();
$queryString = http_build_query($params);
curl_setopt($ch, CURLOPT_URL, $url . '?' . $queryString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
curl_close($ch);
return ['error' => $error_msg];
}
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return ['response' => $response, 'http_code' => $http_code];
}
$params = [
'meeting_id' => $meetingId,
'checksum' => hash('sha256',$meetingId.$bbbSecret),
'fields_select' => ''
];
// Send the GET request and get the response
$response = sendGetRequest('https://'.$serverUrl.'/bbb-transcript/get_transcript.php', $params);
// Display the response
if (array_key_exists('error', $response)){
echo $response['error'];
exit();
}
echo "HTTP Status Code: " . $response['http_code'] . "\n";
echo "Response: " . print_r(json_decode($response['response']), true . "\n");