<?php
/*
idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
*/

$ruta = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/inicioSesion/seleccionar";

$required_params = [
    "username"=>"SGU_APSA_AUD_ASIST",
    "password"=>"B4qa594JFPr2ufHrZdHS8A=="
];
try{
    $curl = curl_init();
    curl_setopt_array($curl, [
        CURLOPT_URL => $ruta,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => json_encode($required_params),
        CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
    ]);
    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err)
        die("cURL Error #:$err");

    $token = json_decode($response, true);
    //echo "token $token";
}catch(Exception $e){
    echo $e->getMessage();
    exit();
}
?>
