lib/DataSift/ApiClient.php
private static function initialize($method, $ssl, $url, $headers, $params, $userAgent, $qs, $raw = false)
    {
        $ch = curl_init();

        switch (strtolower($method)) {
            case 'post':
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, ($raw ? $params : json_encode($params)));
                break;
            case 'get':
                curl_setopt($ch, CURLOPT_HTTPGET, true);
                break;
            case 'put':
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
                break;
            case 'delete':
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
                break;
            default:
                throw new DataSift_Exception_NotYetImplemented('Method not of valid type');
        }

        $url = self::appendQueryString($url, $qs);

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

        if ($ssl) {
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_SSLVERSION, 'CURL_SSLVERSION_TLSv1_2');
        }

        return $ch;
    }
private static function initialize($method, $ssl, $url, $headers, $params, $userAgent, $qs, $raw = false)
    {
        $ch = curl_init();

        switch (strtolower($method)) {
            case 'post':
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, ($raw ? $params : json_encode($params)));
                break;
            case 'get':
                curl_setopt($ch, CURLOPT_HTTPGET, true);
                break;
            case 'put':
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
                break;
            case 'delete':
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
                break;
            default:
                throw new DataSift_Exception_NotYetImplemented('Method not of valid type');
        }

        $url = self::appendQueryString($url, $qs);

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

        if ($ssl) {
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_SSLVERSION, 'CURL_SSLVERSION_TLSv1_2');
        }

        return $ch;
    }
private static function initialize ( $ method , $ ssl , $ url , $ headers , $ params , $ userAgent , $ qs , $ raw = false ) { $ ch = curl_init ( ) ; switch ( strtolower ( $ method ) ) { case 'post' : curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , ( $ raw ? $ params : json_encode ( $ params ) ) ) ; break ; case 'get' : curl_setopt ( $ ch , CURLOPT_HTTPGET , true ) ; break ; case 'put' : curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , 'PUT' ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , json_encode ( $ params ) ) ; break ; case 'delete' : curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , 'DELETE' ) ; break ; default : throw new DataSift_Exception_NotYetImplemented ( 'Method not of valid type' ) ; } $ url = self :: appendQueryString ( $ url , $ qs ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_HEADER , true ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_USERAGENT , $ userAgent ) ; if ( $ ssl ) { curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , true ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , 2 ) ; curl_setopt ( $ ch , CURLOPT_SSLVERSION , 'CURL_SSLVERSION_TLSv1_2' ) ; } return $ ch ; }
Initalize the cURL connection.

@param string  $method    The HTTP method to use.
@param boolean $ssl       Is SSL Enabled.
@param string  $url       The URL of the call.
@param array   $headers   The headers to be sent.
@param array   $params    The parameters to be passed along with the request.
@param string  $userAgent The HTTP User-Agent header.

@return resource The cURL resource
@throws DataSift_Exception_NotYetImplemented
Initalize the cURL connection .