I have an url, and I want to download the file via R
, I notice that download.file
would be helpful, but my problem seems different:
url <- "http://journal.gucas.ac.cn/CN/article/downloadArticleFile.do?attachType=PDF&id=11771"
destfile <- "myfile.pdf"
download.file(url, destfile)
It doesn't work! I notice that if my url
is in the form of xxx.pdf
, then the code above is no problem, otherwise the file that is downloaded is corrupt.
Does anyone know how to solve this problem?