/
example.php
44 lines (38 loc) · 1.08 KB
/
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
42
43
44
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>BakalariGradesAPI – example of usage</title>
</head>
<body>
<?php
date_default_timezone_set('Europe/Prague');
//Bakalari credentials and other setting
require('example.config.php');
require('vendor/autoload.php');
try {
$bakalari = new BakalariGradesAPI($username, $password, $host, $cookieFile);
$subjects = $bakalari->getGrades();
foreach ($subjects as $subject => $grades): ?>
<h2><?php echo $subject ?></h2>
<table border=1>
<tr>
<th>Grade</th>
<th>Description</th>
<th>Date</th>
</tr>
<?php foreach ($grades as $grade): ?>
<tr>
<td><?php echo $grade['grade'] ?></td>
<td><?php echo $grade['description'] ?></td>
<td><?php echo $grade['date'] ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php endforeach;
} catch (Exception $e) {
echo $e->getMessage();
}
?>
</body>
</html>