token.php 969 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
  4. */
  5. $ruta = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/inicioSesion/seleccionar";
  6. $required_params = [
  7. "username"=>"SGU_APSA_AUD_ASIST",
  8. "password"=>"B4qa594JFPr2ufHrZdHS8A=="
  9. ];
  10. try{
  11. $curl = curl_init();
  12. curl_setopt_array($curl, [
  13. CURLOPT_URL => $ruta,
  14. CURLOPT_RETURNTRANSFER => true,
  15. CURLOPT_CUSTOMREQUEST => "POST",
  16. CURLOPT_POSTFIELDS => json_encode($required_params),
  17. CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
  18. ]);
  19. $response = curl_exec($curl);
  20. $err = curl_error($curl);
  21. curl_close($curl);
  22. if ($err)
  23. die("cURL Error #:$err");
  24. $token = json_decode($response, true);
  25. //echo "token $token";
  26. }catch(Exception $e){
  27. echo $e->getMessage();
  28. exit();
  29. }
  30. ?>