"https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/catalogos/periodos/v2/seleccionar", CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => "", CURLOPT_HTTPHEADER => [ "token: 5b892845736a29b5846073be0a11f0fc87113648aae1e8279830c4bc05f585eba13e0b1b4f0c42a12d694bb8091d23f7564b15f3141768dfa6ed2aa709864986", "username: SGU_APSA_AUD_ASIST" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) die("cURL Error #:$err"); $json = json_decode($response, true); $selectedData = array_map(function ($item) use ($db) { $item['in_db'] = $db->where('carrera_nombre', $item['NombreCarrera'], 'ILIKE')->has('carrera'); $item['linked'] = $db->where('clave_carrera', $item['ClaveCarrera'], 'ILIKE')->has('carrera'); return $item; }, $json); // Output the selected data directly header('Content-Type: application/json'); echo json_encode($selectedData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);