You are here

public static function MoAuthUtilities::get_timestamp in Google Authenticator / 2 Factor Authentication - 2FA 7

File

classes/Utilities.php, line 207
This file is part of miniOrange 2FA module.

Class

MoAuthUtilities
@file This file is part of miniOrange 2FA module.

Code

public static function get_timestamp() {
  $url = MoAuthConstants::getBaseUrl() . '/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);
  return $content;
}