How to read CSV to R from HTTP using AUTH

I am trying to read CSV with R from a URL that has auth , I have a password and all I just need to know is what to add to the command, btw my password includes @ char, so it messed up my scheme [1]

This is the command I'm trying to execute:

 products <- read.csv("http://username: pass@word @domain.com/api/products_by_date.csv?start_date=2011-04-01&end_date=2011-04-01", head=TRUE) 

My conclusion:

 Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : unable to resolve 'username' [1] scheme://username: password@domain :port/path?query_string#fragment_id 
+4
source share
1 answer

you can try getURL in the RCurl package, which has HTTP request authentication features. see ?getURL for an example.

+5
source

All Articles