[R] Again: wget parameters

Gavin Simpson gavin.simpson at ucl.ac.uk
Fri Aug 27 10:16:43 CEST 2010


Look at the RCurl package. I've used this to automate donwloading files
from a web server with this sort of authentication:

I have this is in a file I used earlier in the year:

require("RCurl")
URL <-
"http://www.metoffice.gov.uk/climatechange/science/monitoring/data/Daily_grids/MeanTemp/MeanTemp_1990.zip"
## get the zipped file
f <- getBinaryURL(URL, userpwd = "USERNAME:PASSWORD", verbose = TRUE)
## write the file to disk
writeBin(f, "mean_daily_temp_1990.zip")

If you want a text file look at getURL() and writeChar() or if you
aren't sure, then the function getURLContent() will determine what the
file content is.

Unfortunately, binaries are not available on CRAN for MacOS X and
Windows, though Prof. Brian Ripley provides a binary for the later - see
the link on the RCurl page on CRAN:

http://cran.r-project.org/web/packages/RCurl/index.html

The source is available if you can compile on your system.

HTH

G

On Fri, 2010-08-27 at 00:27 +0200, [Ricardo Rodriguez] Your XEN ICT Team
wrote:
> Hi Christian!
> 
> Sorry for being late.
> 
> David Winsemius wrote:
> > 
> > On Aug 18, 2010, at 2:58 PM, christiaan pauw wrote:
> > 
> >> Hi Ricardo and everybody
> >>
> >> In this old post to rhelp you say that the problem was solved but not 
> >> what
> >> the sollution was. I have the same problem now. I want to read a Excel 
> >> file
> >> from a google site that has restricted access so I need to give a 
> >> username
> >> and password at some point. I could not find an example or a help file 
> >> that
> >> shows how this can be done. You post is one of few but it does not 
> >> contain
> >> the answer
> > 
> > wget is not in R.
> > 
> > http://wiki.archlinux.org/index.php/Wget
> > 
> 
> I've regained access to this issue. In facts, it has never been solved! 
> My old message with a solved in it talked about my error sending HTML 
> formated messages, not about how to deal with this issue. Sorry for not 
> being clear!
> 
> I invested a lot of time looking for a solution but every alternative 
> fails at one end: XWiki doesn't accept username:password pairs in the 
> URL yet and I don't know how to pass these parameters to the 
> download.file R function.
> 
> What keeps been truth is that this, for instance, works at command line 
> (in my case, MacOSX terminal):
> 
> wget --http-user=DummyDummy --http-password=dummy --auth-no-challenge 
> --output-document=RG2.txt 
> http://xepecnet.environmentalchange.net/xwiki/bin/view/ICT/RGraphicSample02?xpage=plain
> 
> And saves RG2.txt in your current directory. But I don't now yet how to 
> pass parameters like --http-user to method wget in R download.file.
> 
> Perhaps you could try this syntax to see if Google accept it.
> 
> OK, wget is not in R, but it could be used within R download.file 
> function, so I would think that this is a possible place to ask about 
> this topic. Thanks!!!
> 
> Greetings,
> 
> Ricardo
> 

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list