You are here

function MiniorangeSAMLCustomer::callService in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

6 calls to MiniorangeSAMLCustomer::callService()
MiniorangeSAMLCustomer::checkCustomer in includes/customer_setup.php
Check if customer exists.
MiniorangeSAMLCustomer::createCustomer in includes/customer_setup.php
Create Customer.
MiniorangeSAMLCustomer::getCustomerKeys in includes/customer_setup.php
Get Customer Keys.
MiniorangeSAMLCustomer::getTimeStamp in includes/customer_setup.php
MiniorangeSAMLCustomer::sendOtp in includes/customer_setup.php
Send OTP.

... See full list

File

includes/customer_setup.php, line 105
Contains miniOrange Customer class.

Class

MiniorangeSAMLCustomer
@file This class represents configuration for customer.

Code

function callService($url, $fields, $addExtendedHeader = FALSE, $logError = TRUE) {
  if (!Utilities::isCurlInstalled()) {
    return json_encode(array(
      "statusCode" => 'ERROR',
      "statusMessage" => 'cURL is not enabled on your site. Please enable the cURL module.',
    ));
  }
  $fieldString = is_string($fields) ? $fields : json_encode($fields);
  $header = $this
    ->getHeader($addExtendedHeader);
  $response = drupal_http_request($url, [
    'data' => $fieldString,
    'method' => 'POST',
    'allow_redirects' => TRUE,
    'http_errors' => FALSE,
    'decode_content' => true,
    'verify' => FALSE,
    'headers' => $header,
  ]);
  if (isset($response->error) && $response->code != 200 && $logError) {
    $error = array(
      '%apiName' => explode("moas", $url)[1],
      '%error' => $response->error,
    );
    watchdog('miniorange_saml_idp', 'Error at %apiName of  %error', $error);
  }
  return $response->data;
}