protected function prepareCurl()
    {
        $this->curl = curl_init();
        $this->complete = Complete::factory(function() {
            if ($this->curl) {
                curl_close($this->curl);
            }
            $this->curl     = null;
            $this->complete = null;
        });

        foreach(self::$curlOptions as $option => $value) {
            curl_setopt($this->curl, $option, $value);
        }
        if ($this->method === HttpMethods::POST) {
            curl_setopt($this->curl, CURLOPT_POST, true);
        }
        if (!empty($this->auth)) {
            curl_setopt($this->curl, CURLOPT_USERPWD, sprintf(
                "%s:%s",
                $this->auth["user"],
                $this->auth["pass"]
            ));
        }
    }
protected function prepareCurl()
    {
        $this->curl = curl_init();
        $this->complete = Complete::factory(function() {
            if ($this->curl) {
                curl_close($this->curl);
            }
            $this->curl     = null;
            $this->complete = null;
        });

        foreach(self::$curlOptions as $option => $value) {
            curl_setopt($this->curl, $option, $value);
        }
        if ($this->method === HttpMethods::POST) {
            curl_setopt($this->curl, CURLOPT_POST, true);
        }
        if (!empty($this->auth)) {
            curl_setopt($this->curl, CURLOPT_USERPWD, sprintf(
                "%s:%s",
                $this->auth["user"],
                $this->auth["pass"]
            ));
        }
    }
protected function prepareCurl ( ) { $ this -> curl = curl_init ( ) ; $ this -> complete = Complete :: factory ( function ( ) { if ( $ this -> curl ) { curl_close ( $ this -> curl ) ; } $ this -> curl = null ; $ this -> complete = null ; } ) ; foreach ( self :: $ curlOptions as $ option => $ value ) { curl_setopt ( $ this -> curl , $ option , $ value ) ; } if ( $ this -> method === HttpMethods :: POST ) { curl_setopt ( $ this -> curl , CURLOPT_POST , true ) ; } if ( ! empty ( $ this -> auth ) ) { curl_setopt ( $ this -> curl , CURLOPT_USERPWD , sprintf ( "%s:%s" , $ this -> auth [ "user" ] , $ this -> auth [ "pass" ] ) ) ; } }
Initializes the curl resource
Initializes the curl resource