How to pass the curl --insecure alternative when using R?



如何使用R下载此文件并将其保存到磁盘?

我通过在命令行上使用curl在其上添加--insecure标志已经下载了它。但是我无法弄清楚如何在R中进行。

这是命令行:

curl https://www.stf.jus.br/arquivo/djEletronico/DJE_20171123_266.pdf --insecure --output ~/Desktop/test2.pdf

您可以使用curl库:

library(curl)
URL <- "https://www.stf.jus.br/arquivo/djEletronico/DJE_20171123_266.pdf"   
h <- new_handle()
handle_setopt(h, ssl_verifyhost = 0, ssl_verifypeer=0)
curl_download(url=URL, "file_test2.pdf", handle = h)