Open cpfaff opened 8 years ago
When users download and upload data they need to authenticate. This can be done with curl package directly:
# Set your browsing links loginurl = "http://api.my.url/login" dataurl = "http://api.my.url/data" #Set user account data and agent pars=list( username="xxx" password="yyy" ) agent="Mozilla/5.0" #or whatever #Set RCurl pars curl = getCurlHandle() # curlSetOpt(cookiejar="", useragent = agent, followlocation = TRUE, curl=curl) curlSetOpt(cookiejar="cookie.txt", useragent = agent, followlocation = TRUE, curl=curl) # Login html = postForm(loginurl, .params = pars, curl=curl) #Go wherever you want html = getURL(dataurl, curl=curl)
another option would be to use the httr package
require(httr) GET("authenticationurl", authenticate(user="username", password="pass")) store = GET("urlToData")
It takes care of the cookies and persists them over the calls to the same url. I think we should go the second way.
When users download and upload data they need to authenticate. This can be done with curl package directly:
another option would be to use the httr package
It takes care of the cookies and persists them over the calls to the same url. I think we should go the second way.