I found a great project called r-google-analytics that I'd like to use so I can manipulate GA dat in R at this website http://code.google.com/p/r-google-analytics/.
I run this portion of the code:
library(RCurl)
library(XML)
# 1. Create a new Google Analytics API object
ga <- RGoogleAnalytics()
# 2. Authorize the object with your Google Analytics Account Credentials
ga$SetCredentials("INSERT_USER_NAME", "INSERT_PASSWORD")
And I get this error message:
Error in postForm("https://www.google.com/accounts/ClientLogin", Email = username, :
SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_S开发者_运维知识库ERVER_CERTIFICATE:certificate verify failed
Any ideas as to what could be causing the error?
Thanks!
Kim
see http://www.omegahat.org/RCurl/FAQ.html for a thorough explanation and particularly (depending on your preference for security):
If you don't have a certificate from an appropriate signing agent, you can suppress verifying the certificate with the ssl.verifypeer option:
x = getURLContent("https://www.google.com", ssl.verifypeer = FALSE)
I had a similar problem and this helped me out:
Use the alternative internet2.dll by starting R with the flag --internet2 (see How do I install R for Windows?) or calling setInternet2(TRUE). These cause R to use the Internet Explorer internals, which may already be configured for use with proxies. Note that this does not work with proxies that need authentication.
While I was researching the issue, I also discovered that other users reported this issue when they had non-alphanumeric characters (i.e. not A-Za-z0-9) in their password.
As a good practice some reference to both the R sessionInfo() and the OS (uname -a in unix-like systems) could be of some use!
Some basic Googling could also guide you in finding a solution, see for example:
http://curl.haxx.se/docs/sslcerts.html
http://www.linuxquestions.org/questions/slackware-14/openssl-ssl-error-code-14090086-verify-the-ca-cert-is-ok-certificate-verify-failed-703523/
HIH!
Here is the shortcut, just copy, change pathway and paste:
source("C:\\Users\\cloudstat\\Desktop\\Google analytics Plus\\RGoogleAnalytics.R")
source("C:\\Users\\cloudstat\\Desktop\\Google analytics Plus\\QueryBuilder.R")
install.packages("C:\\Users\\cloudstat\\Desktop\\Google analytics Plus\\RGoogleAnalytics_1.1.tar.gz",repos=NULL,type="source")
library(XML)
library(RCurl)
library(RGoogleAnalytics)
download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
curl <- getCurlHandle()
options(RCurlOptions = list(capath = system.file("CurlSSL", "cacert.pem", package = "RCurl"), ssl.verifypeer = FALSE))
curlSetOpt(.opts = list(proxy = "proxyserver:port"), curl = curl)
ga <- RGoogleAnalytics()
ga$SetCredentials("USERNAME", "PASSWORD")
Good luck :)
Due to changes in Google API system, this is temporary not available to use. I have written a blog on "How to extract the Google aanalytics data in R" with developed R script.
Try running this . Enter the Client Id and Server from the Google Console API manager.
install.packages("RGoogleAnalytics")
install.packages("googleAuthR")
library(RGoogleAnalytics)
client.id <-"################.apps.googleusercontent.com"
client.secret <-"##############_TknUI"
token<-Auth(client.id,client.secret)
精彩评论