src/MVQN/REST/RestClient.php
private static function curl(string $endpoint)
    {
        // Get the base URL and App Key.
        $baseUrl = self::$_baseUrl;

        // Create a cURL session.
        $curl = curl_init();

        // Set the options necessary for communicating with the UCRM Server.
        curl_setopt($curl, CURLOPT_URL, $baseUrl.$endpoint);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, false);

        // IF the Base URL is using HTTPS AND is requesting localhost...
        if(Strings::startsWith(self::$_baseUrl, "https://localhost"))
        {
            // THEN disable host/peer certificate checks, as localhost cannot resolve to a valid name for SSL!
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
        }
        else
        {
            // OTHERWISE, enable host/peer certificate checks, this is fine for all HTTP URLs (including localhost)!
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // DEFAULT
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); // DEFAULT

            // Downloaded from: https://curl.haxx.se/docs/caextract.html
            curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . "/Certificates/cacert-2018-10-17.pem");
            curl_setopt($curl, CURLOPT_CAPATH, __DIR__ . "/Certificates/cacert-2018-10-17.pem");
        }

        // Set the necessary HTTP HEADERS.
        curl_setopt($curl, CURLOPT_HTTPHEADER, self::$_headers);

        return $curl;
    }
private static function curl(string $endpoint)
    {
        // Get the base URL and App Key.
        $baseUrl = self::$_baseUrl;

        // Create a cURL session.
        $curl = curl_init();

        // Set the options necessary for communicating with the UCRM Server.
        curl_setopt($curl, CURLOPT_URL, $baseUrl.$endpoint);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, false);

        // IF the Base URL is using HTTPS AND is requesting localhost...
        if(Strings::startsWith(self::$_baseUrl, "https://localhost"))
        {
            // THEN disable host/peer certificate checks, as localhost cannot resolve to a valid name for SSL!
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
        }
        else
        {
            // OTHERWISE, enable host/peer certificate checks, this is fine for all HTTP URLs (including localhost)!
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // DEFAULT
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); // DEFAULT

            // Downloaded from: https://curl.haxx.se/docs/caextract.html
            curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . "/Certificates/cacert-2018-10-17.pem");
            curl_setopt($curl, CURLOPT_CAPATH, __DIR__ . "/Certificates/cacert-2018-10-17.pem");
        }

        // Set the necessary HTTP HEADERS.
        curl_setopt($curl, CURLOPT_HTTPHEADER, self::$_headers);

        return $curl;
    }
Creates a cURL session with the necessary options, headers and endpoint to communicate with the UCRM Server.

@param string $endpoint The endpoint at which to make the request.
@return resource Returns a cURL session.