使用 R 时如何传递 curl --insecure 替代方案?

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

如何使用 R 下载 this file 并将其保存到磁盘?

我已经通过在命令行上添加 --insecure 标志来使用 curl 下载它。但我不知道如何在 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)