Reputation: 336
I am trying to read a webpage and am getting the error message that the certificate can not be authenticated. My code is:
qurl<-"https://www.chemspider.com/Chemical-Structure.1.html"
h <- try(read_html(qurl), silent = TRUE)
I can access the webpage no worries directly in my browser and I have tried
library(httr)
set_config(config(ssl_verifypeer = 0L))
(also ssl.verifypeer
- I read somewhere that was an older version), but I am still getting the error message:
Peer certificate cannot be authenticated with given CA certificates
I have also tried re-installing curl and even R, but without success. I am using R3.4.0 (3.3.3 before re-installing). Any ideas how I can read this webpage)
Upvotes: 1
Views: 2731
Reputation: 115
I had the same problem with Amazon Linux on an EC2 instance.
I eventually, having tried every suggestion I could find, resorted to:
library(RCurl)
webpage <- getURL("https://sourceforge.net/", .opts=list(followlocation=TRUE, ssl.verifyhost=FALSE, ssl.verifypeer=FALSE))
Upvotes: 2
Reputation: 1
R version 3.3.3 produced the following:
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 ...
Upvotes: 0