Hi Valerie -- curlPerform is expecting the url to be an option that is named, i.e.,
> myopts <-curlOptions(netrc=1) > url <- "http://www.omegahat.org/RCurl/testPassword/index.html" > cat(curlPerform(url=url, .opts=myopts)) <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <title>Basic Password Test</title> </head> <body> <h1>Basic Password Test</h1> This is a test page. If you can read it, you have correctly supplied the password. <hr> <address><a href="http://stat.ucdavis.edu/~duncan">Duncan Temple Lang</a> <a href=mailto:[EMAIL PROTECTED]><[EMAIL PROTECTED]></a></address> <!-- hhmts start --> Last modified: Sun Aug 1 13:57:44 PDT 2004 <!-- hhmts end --> </body> </html> (also curlPerform(url=url, netrc=1)) Martin Valerie Obenchain <[EMAIL PROTECTED]> writes: > Hello, > > I am having trouble getting the curlPerform function to authenticate > using the .netrc file. From the documentation I've read it > certainly seems as though this function should be able to authenticate > via the .netrc file. > > The example I am using here comes from the "R as a Web Client- the > RCurl package" paper and demonstrates using the .netrc file to access > the www.omegahat.org page. Authentication takes place by RCurl (curl) > reading the username and password out of the .netrc file in the user's > home directory. For this example the username is bob and password is > welcome. The .netrc file in the user's home directory contains the > following information: > machine www.omegahat.org > login bob > password welcome > > > I can successfully use the .netrc file with the getURL function: > > getURL("http://www.omegahat.org/RCurl/testPassword/index.html", netrc=1) > > [1] "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n<html> > <head>\n<title>Basic Password Test</title>\n</head>\n\n<body>\n<h1>Basic > Password Test</h1>\nThis is a test page.\nIf you can read it, you have > correctly supplied\nthe password.\n\n\n<hr>\n<address><a > href=\"http://stat.ucdavis.edu/~duncan\">Duncan Temple Lang</a>\n<a > href=mailto:[EMAIL PROTECTED]><[EMAIL PROTECTED]></a></address>\n<!-- > hhmts start -->\nLast modified: Sun Aug 1 13:57:44 PDT 2004\n<!-- > hhmts end -->\n</body> </html>\n" > > > When I try to do the same with the curlPerform function I get an error > saying that the curl option is not recognized. I have tried 3 > different > ways of instructing the curlPerform function to use the .netrc file > (in the .opts, curl handle and the ... argument) but got the same > error message each time. > > # Failed attempt using .opts construct > myopts <-curlOptions(netrc=1) > curlPerform("http://www.omegahat.org/RCurl/testPassword/index.html", > .opts=myopts) > > # Failed attempt using curl handle > handle <- getCurlHandle(netrc=1) > curlPerform("http://www.omegahat.org/RCurl/testPassword/index.html", > curl=handle) > > # Failed attempt using ... construct > curlPerform("http://www.omegahat.org/RCurl/testPassword/index.html", > netrc=1) > > Common error message for all failed attempts: > Error in mapCurlOptNames(names(.els), asNames = TRUE) : > Unrecognized CURL options: > > > Valid curl option names are listed by typing listCurlOptions() and > netrc is one of the options. The mapCurlOptNames code is not available > for the user to view so I'm not able to deduce anything more from the > error message. > > > Thanks, > Valerie > > ______________________________________________ > R-help@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. -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M2 B169 Phone: (206) 667-2793 ______________________________________________ R-help@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.