[R] How to set cookies in RCurl

mdvaan mathijsdevaan at gmail.com
Thu Jun 7 16:33:53 CEST 2012


Hi,

I am trying to access a website and read its content. The website is a
restricted access website that I access through a proxy server (which
therefore requires me to enable cookies). I have problems in allowing Rcurl
to receive and send cookies. 

The following lines give me:

library(RCurl)
library(XML)

url <- "http://www.theurl.com"
content <- readHTMLTable(url)

content
$`NULL`
                                                                                                                                                                         
V1
1                                                                                                                                                                           
2                                                                                                                                                          
Cookies disabled
3                                                                                                                                                                           
4 Your browser currently does not accept cookies.\rCookies need to be
enabled for Scopus to function properly.\rPlease enable session cookies in
your browser and try again.

$`NULL`
  V1 V2 V3
1         

$`NULL`
                V1
1 Cookies disabled

$`NULL`
  V1
1   
2   
3  

I have carefully read section 4.4. from this:
http://www.omegahat.org/RCurl/RCurlJSS.pdf and tried the following without
succes:

curl <- getCurlHandle()
curlSetOpt(cookiejar = 'cookies.txt', curl = curl)

Any suggestions on how to allow for cookies?

Thanks.

Math

--
View this message in context: http://r.789695.n4.nabble.com/How-to-set-cookies-in-RCurl-tp4632693.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list