title: Downloading a file after login using a https URL
body: <p>I am trying to download an excel file, which I have the link to, but I am required to log in to the page before I can download the file.  I have successfully passed the login page with rvest, rcurl and httr, but I am having an extremely difficult time downloading the file after I have logged in.  </p>
  
  <pre><code>url &lt;- "https://website.com/console/login.do"
  download_url &lt;- "https://website.com/file.xls"
  session &lt;- html_session(url)
  form &lt;- html_form(session)[[1]]
  
  filled_form &lt;- set_values(form,
                            userid = user,
                            password = pass)
  
  ## Save main page url
  main_page &lt;- submit_form(session, filled_form)
  
  download.file(download_url, "./file.xls", method = "curl")
  </code></pre>
  
  <p>When I run the download.file command, the file pops up in my working directory, but it is not the file I am trying to download, and is actually just a corrupted .XLS file with no data.  </p>
  
  <p>For reference, if I log in to the website via chrome, and paste the download link into the browser window after I have logged in, the file automatically starts downloading.  If I do the same in IE, the file download dialog box pops up and asks me if I want to save the file.</p>
  
  <p>Possibly relevant info:</p>
  
  <ul>
  <li>This is for my computer at work, where cookies are disabled, so I cannot use a cookie from my browser</li>
  <li>I have tried using different methods with httr and rcurl based on numerous posts on SO to no avail </li>
  </ul>
  
  <p>Thanks in advance for your time!</p>