2013-03-11 2 views
17

에서 실패했습니다. 비슷한 질문이 다시 제기되었습니다. 그러나, 나는 여기에서 찾은 모든 것을 시험해 보았고 아무 것도 나를 위해 일하는 것 같지 않다.twitteR에 대한 SSL 인증서가 R

여기
reqURL <- "http://api.twitter.com/oauth/request_token" 
accessURL <- "http://api.twitter.com/oauth/access_token" 
authURL <- "http://api.twitter.com/oauth/authorize" 
consumerKey <- "xxxxxxxxxxx" 
consumerSecret <- "xxxxxxxxxxxxxxxxxxx" 
twitCred <- OAuthFactory$new(consumerKey=consumerKey, 
         consumerSecret=consumerSecret, 
         requestURL=reqURL, 
         accessURL=accessURL, 
         authURL=authURL) 
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")) 
registerTwitterOAuth(twitCred) 

내가 얻을 :

내 코드는 다음과 [1] TRUE

을하지만 내가하려고하면이 : tweets = searchTwitter('blabla', n=1500)

나는 다음과 같은 오류 얻을 : [1] "SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed" Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) : Error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

다음은 패키지와 그 반대입니다. 내 PC에 기능 :

sessionInfo() R version 2.15.1 (2012-06-22) Platform: i386-pc-mingw32/i386 (32-bit)

locale: 
[1] LC_COLLATE=Greek_Greece.1253 LC_CTYPE=Greek_Greece.1253 
[3] LC_MONETARY=Greek_Greece.1253 LC_NUMERIC=C     
[5] LC_TIME=Greek_Greece.1253  

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

other attached packages: 
[1] ROAuth_0.9.2 digest_0.6.2 twitteR_1.1.0 rjson_0.2.12 
[5] RCurl_1.95-4.1 bitops_1.0-5 

loaded via a namespace (and not attached): 
[1] tools_2.15.1 

어떤 도움이 정말 유용 할 것이다!

+0

가능한 중복 : http://stackoverflow.com/q/9916283/1036500 (나는 그것이 ... 중 하나가 작동하지 수) – Ben

+0

를 그냥 편집증의 비트를 추가합니다 : 아니 모든 SSL 인증서 오류는 프로그래밍 오류입니다. 그 중 일부는 실제 공격입니다 (예 : 고용주, ​​정부 또는 다른 제 3자가 잘못된 인증서를 대체 함). Twitter가 Google 크롬에서 제대로 작동합니까? – themel

+0

예, 그렇지 않습니다. – Stergios

답변

1

cacert.pem 파일을 업데이트해야 할 수도 있습니다. 이와 관련된 다른 질문에 대한 링크는 herehere을 참조하십시오. download.file()을 사용하는 다른 사람들에게는 이것이 효과가없는 것으로 보입니다. 그러나 이것은 Curl을 직접 사용하는 것일 수 있습니다.

+0

Simon에게 감사 드려요. 그러나 그것은 나를 위해 일하지 않는 것 같습니다. 왜 그렇게 많은 사람들이 트위터 API에 동일한 문제가 있습니까? 내가 시도 할 수있는 다른 것? – Stergios

17

처음 다음을 수행

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, 다음 코드를 실행합니다 : 당신은 너무처럼 번들 파일을 업데이트 할 수 있습니다

library(RCurl) 

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

이것은 일반적으로 당신이 경험 한 문제가 해결합니다.

EDIT (2014년 8월) :또는 더 나은 아직이

2

(당신을 위해 설정 유용한 기본 옵션으로 RCurl의 친절한 래퍼 인) 대신 HTTR 패키지를 사용하려고 마침내 내가 솔루션을 가지고 ,이 방법을 시도하십시오. 이것은 매우 간단

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) 
관련 문제