Commit inicial
This commit is contained in:
41
rest/token.php.save
Normal file
41
rest/token.php.save
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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();
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user