title: R: Download file from internet
body: <p>I am having problem downloading a csv file from internet. </p>
  
  <p>I tried the following code, but I wasn't able to make it work. </p>
  
  <pre><code>myurl &lt;- "http://unstats.un.org/unsd/mdg/Handlers/ExportHandler.ashx?Type=Csv&amp;Series=761"
  download.file(myurl, destfile="./test.csv",method="curl")
  </code></pre>
  
  <p>Instead I received the following output.</p>
  
  <blockquote>
  <pre><code>% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0100 16313  100 16313    0     0  11961      0  0:00:01  0:00:01 --:--:-- 11959100 16313  100 16313    0     0  11960      0  0:00:01  0:00:01 --:--:-- 11959
  </code></pre>
  </blockquote>
  
  <p>When I manually download, a file like this is generated "MDG_Export_20150821_224828123.csv". 
  The server generates a new file name (MDG_Export + date + time).</p>
  
  <p>Is there anyway I can download this from my R program because the manual download is not an option in my project?</p>
  
  <p>Thank you for your help.</p>