我正在尝试自动登录英国的数据存档服务.该网站显然值得信赖.不幸的是,RCurl与httr在SSL验证休息.我的网络浏览器不会发出任何警告.我可以通过使用来解决这个问题ssl.verifypeer = FALSE,RCurl但我想了解发生了什么?
# breaks
library(httr)
GET( "https://www.esds.ac.uk/secure/UKDSRegister_start.asp" )
# breaks
library(RCurl)
cert <- system.file("CurlSSL/cacert.pem", package = "RCurl")
getURL("https://www.esds.ac.uk/secure/UKDSRegister_start.asp",cainfo = cert)
# works
library(RCurl)
getURL(
"https://www.esds.ac.uk/secure/UKDSRegister_start.asp" ,
.opts = list(ssl.verifypeer = FALSE)
) # note: use list(ssl.verifypeer = FALSE,followlocation=TRUE) to see content
Run Code Online (Sandbox Code Playgroud) 我在使用RCurl函数getURL访问使用自签名证书的服务器上的HTTPS URL 时遇到问题.我在Mac OS X 10.9.2上运行R 3.0.2.
我已经阅读了有关该主题的常见问题解答和卷曲页面.所以这就是我的立场:
RCurl顽固地拒绝使用以下代码连接到该网站:
getURL(" https://somesite.tld ",verbose = T,cainfo = normalizePath("〜/ cert.pem"))
这是我得到的输出:
* Adding handle: conn: 0x7f92771b0400
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 38 (0x7f92771b0400) send_pipe: 1, recv_pipe: 0
* About to connect() to somesite.tld port 443 (#38)
* Trying 42.42.42.42...
* Connected to somesite.tld (42.42.42.42) port 443 …Run Code Online (Sandbox Code Playgroud) I\xe2\x80\x99m 尝试使用quantmodR 中的包从雅虎获取财务数据。它在我的个人笔记本电脑(Mac 和 Win)上完美运行。但我无法让它在我的工作计算机(Win7)上运行。
我的代码是:
\ngetSymbols("JPM", src = "yahoo")\nRun Code Online (Sandbox Code Playgroud)\n请注意,它仅不适用于我公司的笔记本电脑。
\n这是错误代码:
\nError in curl::curl_download(cu, tmp, handle = h) : \nSSL certificate problem: unable to get local issuer certificate\nRun Code Online (Sandbox Code Playgroud)\n我尝试通过以下方式解决问题:
\n安装httr包
删除curl并quantmod重新安装
更新到最新版本的 R、RStudio curl、、、httr和RCurlquantmod
安装openssl包
放ssl_verifypeer = 0L
之前添加以下内容getSymbols
options(download.file.method = "wget", download.file.extra …