<?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_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => json_encode($required_params),
        CURLOPT_HTTPHEADER => [
            "Content-Type: application/json"
        ],
    ]);
    $response = curl_exec($curl);
    print_r($response);
    $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();
}
?>
