Michael Roberts
2012-Apr-04 21:42 UTC
[R] Using download.file() to grab information from a Password Protected Website
I am new to R and have been spinning my wheels on the following. *Issue:* I have a membership to a website, and I want to grab data from the website using download.file(). download.file(url, destfile, method, quiet = T, mode = "w", cacheOK = TRUE) The R Documentation is helpful. However, I have been unsuccessful in figuring out how to access the website using my username and password. Using an example, can someone show me how to embed the username and password into download.file() so that I can grab the data? Better yet, can I tell R to always use the username and password when accessing the site? Will I need information other than the url, username and password? Thanks for your time and help! MTR [[alternative HTML version deleted]]
R. Michael Weylandt
2012-Apr-05 02:35 UTC
[R] Using download.file() to grab information from a Password Protected Website
Authenticated access is sometimes a little harder than a simple download -- the RCurl package provides tools that will be helpful, but you'll need to tailor things to the sort of authentication used on the other end. getURL iprovides one example of password authentication in the examples. If you are using ftp, also see http://www.devx.com/tips/Tip/5604 Hope this helps, Michael On Wed, Apr 4, 2012 at 5:42 PM, Michael Roberts <mtr54 at law.georgetown.edu> wrote:> I am new to R and have been spinning my wheels on the following. > > *Issue:* ?I have a membership to a website, and I want to grab data from > the website using download.file(). > > download.file(url, destfile, method, quiet = T, mode = "w", cacheOK = TRUE) > The R Documentation is helpful. ?However, I have been unsuccessful in > figuring out how to access the website using my username and password. > > Using an example, can someone show me how to embed the username and > password into download.file() so that I can grab the data? ?Better yet, can > I tell R to always use the username and password when accessing the site? > Will I need information other than the url, username and password? > > Thanks for your time and help! > > MTR > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.