periodos.v2.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?
  2. $ruta = "../";
  3. require_once '../include/bd_pdo.php';
  4. global $db;
  5. $curl = curl_init();
  6. curl_setopt_array($curl, [
  7. CURLOPT_URL => "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/catalogos/periodos/v2/seleccionar",
  8. CURLOPT_RETURNTRANSFER => true,
  9. CURLOPT_POSTFIELDS => "",
  10. CURLOPT_HTTPHEADER => [
  11. "token: f65f921264e4ab135472adb5a946212dd4b995d929294afec31eef192b8de8d6a076648906f70012c9803e5918d0fc99499d7d1fb7c998cc06c7a10eef61f66a",
  12. "username: SGU_APSA_AUD_ASIST"
  13. ],
  14. ]);
  15. $response = curl_exec($curl);
  16. $err = curl_error($curl);
  17. curl_close($curl);
  18. if ($err)
  19. die("cURL Error #:$err");
  20. $json = json_decode($response, true);
  21. $selectedData = array_map(function ($item) use ($db) {
  22. $item['in_db'] = $db->where('carrera_nombre', $item['NombreCarrera'], 'ILIKE')->has('carrera');
  23. $item['linked'] = $db->where('id_referencia', $item['ClaveCarrera'], 'ILIKE')->has('carrera');
  24. return $item;
  25. }, $json);
  26. // Output the selected data directly
  27. header('Content-Type: application/json');
  28. echo json_encode($selectedData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);