Files
paad/service/periodos.v1.php
2023-08-08 17:04:21 +00:00

35 lines
1.1 KiB
PHP

<?
$ruta = "../";
require_once '../include/bd_pdo.php';
$curl = curl_init();
global $db;
curl_setopt_array($curl, [
CURLOPT_URL => "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/catalogos/periodos/v1/seleccionar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => [
"token: f65f921264e4ab135472adb5a946212dd4b995d929294afec31eef192b8de8d6a076648906f70012c9803e5918d0fc99499d7d1fb7c998cc06c7a10eef61f66a",
"username: SGU_APSA_AUD_ASIST"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err)
die("cURL Error #:$err");
$data = json_decode($response, true);
$in_db = array_map(function ($item) use ($db) {
$item['in_db'] = $db->where('id_reference', $item['IdPeriodo'])->has('periodo');
return $item;
}, $data);
$selectedData = array_unique($in_db, SORT_REGULAR);
// Output the selected data directly
header('Content-Type: application/json');
echo json_encode($selectedData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);