private function _createCurlHandle() {

        // Make sure the cURL extension is enabled
        if (!$this->isSupported()) {
            $this->logger->error("cURL extension not found (or not enabled).");
            throw new UnsupportedException('cURL extension not found (or not enabled).');
        }
        $this->logger->info("cURL extension is loaded.");

        // Initialize cURL
        $curl = curl_init();
        // If cURL is still not initialized, then there is a problem
        if (!$curl) {
            $this->logger->error("cURL was unable to initalized successfully.");
            throw new RuntimeException('Unable to create handle for cURL.');
        }
        $this->logger->info("cURL initialised successfully.");

        // Set default cURL configuration
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($curl, CURLOPT_MAXREDIRS, 3);

        // Ensure we correctly perform peer verification for PHP < 5.6 by using
        // our own CA certificate store (see https://wiki.php.net/rfc/tls-peer-verification)
        // otherwise just fall back to the sane system options for PHP >= 5.6
        if (version_compare(PHP_VERSION, '5.6.0', '<')) {
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . '/../../cacert.pem');
            $this->logger->info("Manually specifying CA certificate store.");
        }
        curl_setopt($curl, CURLOPT_USERAGENT, 'xsist10-PHP-client');

        return $curl;
    }
private function _createCurlHandle() {

        // Make sure the cURL extension is enabled
        if (!$this->isSupported()) {
            $this->logger->error("cURL extension not found (or not enabled).");
            throw new UnsupportedException('cURL extension not found (or not enabled).');
        }
        $this->logger->info("cURL extension is loaded.");

        // Initialize cURL
        $curl = curl_init();
        // If cURL is still not initialized, then there is a problem
        if (!$curl) {
            $this->logger->error("cURL was unable to initalized successfully.");
            throw new RuntimeException('Unable to create handle for cURL.');
        }
        $this->logger->info("cURL initialised successfully.");

        // Set default cURL configuration
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($curl, CURLOPT_MAXREDIRS, 3);

        // Ensure we correctly perform peer verification for PHP < 5.6 by using
        // our own CA certificate store (see https://wiki.php.net/rfc/tls-peer-verification)
        // otherwise just fall back to the sane system options for PHP >= 5.6
        if (version_compare(PHP_VERSION, '5.6.0', '<')) {
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . '/../../cacert.pem');
            $this->logger->info("Manually specifying CA certificate store.");
        }
        curl_setopt($curl, CURLOPT_USERAGENT, 'xsist10-PHP-client');

        return $curl;
    }
private function _createCurlHandle ( ) { // Make sure the cURL extension is enabled if ( ! $ this -> isSupported ( ) ) { $ this -> logger -> error ( "cURL extension not found (or not enabled)." ) ; throw new UnsupportedException ( 'cURL extension not found (or not enabled).' ) ; } $ this -> logger -> info ( "cURL extension is loaded." ) ; // Initialize cURL $ curl = curl_init ( ) ; // If cURL is still not initialized, then there is a problem if ( ! $ curl ) { $ this -> logger -> error ( "cURL was unable to initalized successfully." ) ; throw new RuntimeException ( 'Unable to create handle for cURL.' ) ; } $ this -> logger -> info ( "cURL initialised successfully." ) ; // Set default cURL configuration curl_setopt ( $ curl , CURLOPT_CONNECTTIMEOUT , 5 ) ; curl_setopt ( $ curl , CURLOPT_TIMEOUT , 10 ) ; curl_setopt ( $ curl , CURLOPT_FOLLOWLOCATION , 1 ) ; curl_setopt ( $ curl , CURLOPT_MAXREDIRS , 3 ) ; // Ensure we correctly perform peer verification for PHP < 5.6 by using // our own CA certificate store (see https://wiki.php.net/rfc/tls-peer-verification) // otherwise just fall back to the sane system options for PHP >= 5.6 if ( version_compare ( PHP_VERSION , '5.6.0' , '<' ) ) { curl_setopt ( $ curl , CURLOPT_SSL_VERIFYPEER , 1 ) ; curl_setopt ( $ curl , CURLOPT_SSL_VERIFYHOST , 2 ) ; curl_setopt ( $ curl , CURLOPT_CAINFO , __DIR__ . '/../../cacert.pem' ) ; $ this -> logger -> info ( "Manually specifying CA certificate store." ) ; } curl_setopt ( $ curl , CURLOPT_USERAGENT , 'xsist10-PHP-client' ) ; return $ curl ; }
Build a cURL resource with basic configurations already made

@return resource cURL handle
Build a cURL resource with basic configurations already made