add tool for getting all students

This commit is contained in:
Karel Košnar 2024-11-29 16:44:54 +01:00
parent 4085cbb713
commit ca11bae56c
2 changed files with 3367 additions and 0 deletions

24
tools/get_students.php Normal file
View file

@ -0,0 +1,24 @@
<?php
include '../src/osvobdoch_vars.php';
include '../src/osvobdoch_local_vars.php';
$metoda = "GET";
//$cesta = "/api/dochazka/v2/nastaveni";
$cesta = "/api/dochazka/v2/zaci";
# cas "2016-09-30 11:54:12.637";
date_default_timezone_set('Europe/Prague');
$cas= date("Y-m-d H:i:s");
$data = $metoda ."+".$cesta . "+" . $cas . "+" . $apiheslo;
$hash = hash_hmac("sha1", $data, $key, $raw_output=false);
$auth = $apiuser . ":" . $hash;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url.$cesta);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $metoda);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"com.edookit.Time: ".$cas,
"com.edookit.Auth: ".$auth,
"com.edookit.Client: ".$id
));
$result = curl_exec($ch);
echo $result;
?>

3343
tools/students.json Normal file

File diff suppressed because it is too large Load diff