osvobozena_dochazka/tools/get_students.php

25 lines
781 B
PHP
Raw Permalink Normal View History

2024-11-29 16:44:54 +01:00
<?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;
?>