Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Page244证书验证报错 #9

Open
@dayushan

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /