'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/inicioSesion/seleccionar', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{"username":"SGU_APSA_AUD_ASIST","password":"B4qa594JFPr2ufHrZdHS8A=="}', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Transfer-Encoding: chunked' ), )); $response = curl_exec($curl); curl_close($curl); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/catalogos/periodos/v1/seleccionar', CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS =>'[]', CURLOPT_HTTPHEADER => array( "token:".json_decode($response, true), 'username: SGU_APSA_AUD_ASIST', 'Transfer-Encoding: chunked' ), )); $response = curl_exec($curl); $periodos = implode("\n", array_map( fn($periodo) => << {$periodo->NombrePeriodo} - {$periodo->NombreNivel} HTML, array_filter( json_decode($response), fn($periodo) => in_array($periodo->IdPeriodo, []) ))); curl_close($curl); echo << {$periodos} HTML;