无法使用给定的CA证书对R和Peer证书进行身份验证

时间:2017-05-02 13:00:14

标签: r ssl

我正在尝试阅读网页,并收到错误消息,证明无法对证书进行身份验证。我的代码是:

qurl<-"https://www.chemspider.com/Chemical-Structure.1.html" h <- try(read_html(qurl), silent = TRUE)

我可以直接在我的浏览器中访问该网页而我已经尝试了

library(httr) set_config(config(ssl_verifypeer = 0L))

(也是ssl.verifypeer - 我读到了旧版本的某个地方),但我仍然收到错误消息:

  

无法使用给定的CA证书对对等证书进行身份验证

我也尝试重新安装curl甚至R,但没有成功。我在使用R3.4.0(3.3.3重新安装之前)。任何想法我如何阅读这个网页)

2 个答案:

答案 0 :(得分:0)

R版本3.3.3产生了以下内容:

install.packages("rvest")
library(rvest)
qurl<-"https://www.chemspider.com/Chemical-Structure.1.html"
h <- try(read_html(qurl), silent = TRUE)
h

{xml_document}
<html xmlns="http://www.w3.org/1999/xhtml">
[1] <head id="ctl00_ctl00_Head1">\n<meta http-equiv="Content-Type" 
content="text/html; charset=UTF-8">\n<link rel="shortcut icon" href=" ...
[2] <body id="ctl00_ctl00_chemspider_body" class="rsc-ui">\r\n    <form 
name="aspnetForm" method="post" action="/Chemical-Structure.1.ht ...

答案 1 :(得分:0)

我在EC2实例上的Amazon Linux遇到了同样的问题。

我最终,在尝试了所有可能找到的建议后,求助于

library(RCurl)
webpage <- getURL("https://sourceforge.net/", .opts=list(followlocation=TRUE, ssl.verifyhost=FALSE, ssl.verifypeer=FALSE))