-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
.libPaths("D:/R/library")
library(RCurl)
library(XML)
library(stringr)
library(plyr)
####因为内容是保存在一个HTTPS服务器上的,需要指定CA签名的位置
all_links<-character()
new_results<-'government/announcements?keywords=&announcement_filter_option=all&topics%5B%5D=all&departments%5B%5D=all&world_locations%5B%5D=all&from_date=&to_date=1%2F7%2F2010'
signatures=system.file("CurlSSL",cainfo='cacert.pem',package='RCurl')
while(length(new_results>0)){
new_results<-str_c("https://www.gov.uk/",new_results)
results<-getURL(new_results,cainfo=signatures)#ssl.verifypeer=FALSE,不验证时并不能获取公告的链接
##验证的时候报错 SSL certificate problem: unable to get local issuer certificate
results_tree<-htmlParse(results)
##获得公告的链接
all_links<-c(all_links,xpathSApply(results_tree,'//li[@id]//a',xmlGetAttr,'href'))
##获得新闻页面的链接
new_results<-xpathSApply(results_tree,'//nav[@id="show-more-documents"]//li[@class="next"]//a',xmlGetAttr,"href")
}
all_links[1]
length(all_links)进行证书验证时报错:
Error in function (type, msg, asError = TRUE) :
SSL certificate problem: unable to get local issuer certificate
不进行证书验证又態下载公告的链接,即all_links为list()
请教下老师,RCurl包在进行证书验证报错应该怎么解决呢
Metadata
Metadata
Assignees
Labels
No labels