SSL certificate failed for twitteR in R

两盒软妹~` 提交于 2019-11-30 06:38:28

Do the following first, and then run your code:

library(RCurl) 

# Set SSL certs globally
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))

This usually corrects the issue you were experiencing.

EDIT (Aug 2014): Or better yet, try to use the httr package instead (which is a friendly wrapper of RCurl with useful default options set for you)

finally i got the solution, please try this method. this is very easy

library(devtools)
install_github("twitteR", username="geoffjentry")
library(twitteR)

api_key = "aaa"
api_secret = "bbb"
access_token = "ccc"
access_token_secret = "ddd"
setup_twitter_oauth(api_key,api_secret,access_token,access_token_secret)
Simon O'Hanlon

You might need to update your cacert.pem file. See here and here for links to other questions regarding this. I see this hasn't worked for other people using download.file(), but this might using Curl directly. You can update your bundle file like so:

system( paste0( "curl http://curl.haxx.se/ca/cacert.pem -o " , tempdir() , "/cacert.pem" ) )
#Then you can use it like so
twitCred$handshake( cainfo = paste0( tempdir() , "/cacert.pem" ) )

HTH

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!