public function acceptCookies($jarfile = null)
    {
        $jarfile = $jarfile ? (string) $jarfile : sys_get_temp_dir().DIRECTORY_SEPARATOR.'cookies.txt';

        if (!is_file($jarfile) && !touch($jarfile)) {
            throw new \LogicException(sprintf('Cookie file "%s" could not be opened. Make sure that the directory is writable.', $jarfile));
        }

        curl_setopt($this->handle, CURLOPT_COOKIEFILE, $jarfile);
        curl_setopt($this->handle, CURLOPT_COOKIEJAR, $jarfile);
    }