[R] access http directories requiring authentication across platforms

Joshua Wiley jwiley.psych at gmail.com
Sat May 1 05:13:58 CEST 2010

Hello R users,

I am trying to read files from a website that requires authentication.
 I have been working with url() to to open a connection in Windows.

For example:

con <- url(description="http://myusername:mypassword@www.somesite.com/myfile.txt",
read.table(con, sep="\t")

This works like a charm.  My question is does this work across
platforms, or only on Windows?  The reason I ask is this quote form
the ?url documentation

     Note that 'https://' connections are only supported if
     '--internet2' or 'setInternet2(TRUE)' was used (to make use of
     Internet Explorer internals), and then only if the certificate is
     considered to be valid.  With that option only, the
     'http://user:pass@site' notation for sites requiring
     authentication is also accepted.

I am sending some scripts to people who use Mac OS X, and (I am
assuming) they will not have Internet Explorer installed.  If it does
not work, is there a more general way?  At least for now, the website
is not using encryption (regular http) and is using basic
authentication controlled via .htaccess and .htpasswd files.



Joshua Wiley
Senior in Psychology
University of California, Riverside

More information about the R-help mailing list