title: download.file in R using wget
body: <p>The webpage I am trying to access downloads an attachment but header status is always 500 which I have checked through postman. </p>
  
  <p>I am using <code>download.file</code> with <code>wget</code> method in R to download that file but it stops and doesn't download since the header status is 500. How can I manage to download this file irrespective of the header status?</p>
  
  <p>When I access this link in browser, the file is downloaded just fine. </p>
  
  <p>Edit:</p>
  
  <p>Here's how I use download.file function in R:</p>
  
  <pre><code>  download.file(get(url), destfile=tmpFile, method = "wget");
  </code></pre>
  
  <p>I tried to pass the extra argument like:</p>
  
  <pre><code> download.file(get(url), destfile=tmpFile, method = "wget", extra =getOption("content-on-error"));
  </code></pre>
  
  <p>and </p>
  
  <pre><code>  download.file(get(url), destfile=tmpFile, method = "wget", extra =getOption("--content-on-error=0"));
  </code></pre>
  
  <p>but it doesn't work</p>
  
  <p>Here : </p>
  
  <p><code>get(url)</code> points to the link:</p>
  
  <pre><code>https://app.adroll.com/api/v1/export/all_campaigns_report?advertisable=__KEY__&amp;reports=AllCampaignsSummary,AllCampaignsChart,AllAds,AllCampaignsSites&amp;start_date=01-01-2013&amp;end_date=10-05-2016&amp;format=csv&amp;currency=USD
  </code></pre>
  
  <p>message on trying to connect:</p>
  
  <pre><code>Resolving app.adroll.com... 52.11.56.178, 52.89.249.63
  Connecting to app.adroll.com|52.11.56.178|:443... connected.
  HTTP request sent, awaiting response... 500 Internal Server Error
  2016-10-06 16:22:21 ERROR 500: Internal Server Error.
  </code></pre>