You are here

public static function Utilities::get_oauth_timestamp in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 7

This function is used to get the timestamp value

2 calls to Utilities::get_oauth_timestamp()
MiniorangeOAuthClientSupport::sendSupportQuery in includes/miniorange_support.php
Send support query.
miniorange_oauth_client_feedback in ./miniorange_oauth_client_feedback.php

File

includes/Utilities.php, line 283

Class

Utilities

Code

public static function get_oauth_timestamp() {
  $url = 'https://login.xecurify.com/moas/rest/mobile/get-timestamp';
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_ENCODING, "");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

  // required for https urls
  curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
  curl_setopt($ch, CURLOPT_POST, true);
  $content = curl_exec($ch);
  if (curl_errno($ch)) {
    echo 'Error in sending curl Request';
    exit;
  }
  curl_close($ch);
  if (empty($content)) {
    $currentTimeInMillis = round(microtime(true) * 1000);
    $currentTimeInMillis = number_format($currentTimeInMillis, 0, '', '');
  }
  return empty($content) ? $currentTimeInMillis : $content;
}