private static function init(RequestOptions $options)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $options->Url);
        curl_setopt_array($ch, self::$defaultOptions);  //default options
        //include headers in response
        curl_setopt($ch, CURLOPT_HEADER, $options->IncludeHeaders);
        //include body in response
        curl_setopt($ch, CURLOPT_NOBODY, !$options->IncludeBody);
        //Set method
        if($options->Method == HttpMethod::Post)
            curl_setopt($ch, CURLOPT_POST, 1);
        else if($options->Method == HttpMethod::Patch)
           curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method);
        else if($options->Method == HttpMethod::Delete)
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method);
        //set Post Body
        if(isset($options->Data))
            curl_setopt($ch, CURLOPT_POSTFIELDS, $options->Data);
        if(is_resource($options->StreamHandle)) {
            $opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE;
            curl_setopt($ch, $opt, $options->StreamHandle);
        }
        $options->addCustomHeader("content-length",strlen($options->Data));
        //custom HTTP headers
        if($options->Headers)
            curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders());
        //debugging mode
        curl_setopt($ch,CURLOPT_VERBOSE, $options->Verbose);
        //SSL Version
        if(!is_null($options->SSLVersion)) {
            curl_setopt($ch,CURLOPT_SSLVERSION, $options->SSLVersion);
        }
        //authentication
        if(!is_null($options->AuthType))
            curl_setopt($ch,CURLOPT_HTTPAUTH, $options->AuthType);
        if(!is_null($options->UserCredentials))
            curl_setopt($ch,CURLOPT_USERPWD, $options->UserCredentials->toString());

        return $ch;
    }
private static function init(RequestOptions $options)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $options->Url);
        curl_setopt_array($ch, self::$defaultOptions);  //default options
        //include headers in response
        curl_setopt($ch, CURLOPT_HEADER, $options->IncludeHeaders);
        //include body in response
        curl_setopt($ch, CURLOPT_NOBODY, !$options->IncludeBody);
        //Set method
        if($options->Method == HttpMethod::Post)
            curl_setopt($ch, CURLOPT_POST, 1);
        else if($options->Method == HttpMethod::Patch)
           curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method);
        else if($options->Method == HttpMethod::Delete)
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method);
        //set Post Body
        if(isset($options->Data))
            curl_setopt($ch, CURLOPT_POSTFIELDS, $options->Data);
        if(is_resource($options->StreamHandle)) {
            $opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE;
            curl_setopt($ch, $opt, $options->StreamHandle);
        }
        $options->addCustomHeader("content-length",strlen($options->Data));
        //custom HTTP headers
        if($options->Headers)
            curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders());
        //debugging mode
        curl_setopt($ch,CURLOPT_VERBOSE, $options->Verbose);
        //SSL Version
        if(!is_null($options->SSLVersion)) {
            curl_setopt($ch,CURLOPT_SSLVERSION, $options->SSLVersion);
        }
        //authentication
        if(!is_null($options->AuthType))
            curl_setopt($ch,CURLOPT_HTTPAUTH, $options->AuthType);
        if(!is_null($options->UserCredentials))
            curl_setopt($ch,CURLOPT_USERPWD, $options->UserCredentials->toString());

        return $ch;
    }
private static function init ( RequestOptions $ options ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ options -> Url ) ; curl_setopt_array ( $ ch , self :: $ defaultOptions ) ; //default options //include headers in response curl_setopt ( $ ch , CURLOPT_HEADER , $ options -> IncludeHeaders ) ; //include body in response curl_setopt ( $ ch , CURLOPT_NOBODY , ! $ options -> IncludeBody ) ; //Set method if ( $ options -> Method == HttpMethod :: Post ) curl_setopt ( $ ch , CURLOPT_POST , 1 ) ; else if ( $ options -> Method == HttpMethod :: Patch ) curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , $ options -> Method ) ; else if ( $ options -> Method == HttpMethod :: Delete ) curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , $ options -> Method ) ; //set Post Body if ( isset ( $ options -> Data ) ) curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ options -> Data ) ; if ( is_resource ( $ options -> StreamHandle ) ) { $ opt = $ options -> Method === HttpMethod :: Get ? CURLOPT_FILE : CURLOPT_INFILE ; curl_setopt ( $ ch , $ opt , $ options -> StreamHandle ) ; } $ options -> addCustomHeader ( "content-length" , strlen ( $ options -> Data ) ) ; //custom HTTP headers if ( $ options -> Headers ) curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ options -> getRawHeaders ( ) ) ; //debugging mode curl_setopt ( $ ch , CURLOPT_VERBOSE , $ options -> Verbose ) ; //SSL Version if ( ! is_null ( $ options -> SSLVersion ) ) { curl_setopt ( $ ch , CURLOPT_SSLVERSION , $ options -> SSLVersion ) ; } //authentication if ( ! is_null ( $ options -> AuthType ) ) curl_setopt ( $ ch , CURLOPT_HTTPAUTH , $ options -> AuthType ) ; if ( ! is_null ( $ options -> UserCredentials ) ) curl_setopt ( $ ch , CURLOPT_USERPWD , $ options -> UserCredentials -> toString ( ) ) ; return $ ch ; }
Init Curl with the default parameters
@param RequestOptions $options
@return resource [type]    [description]
Init Curl with the default parameters