I do not know if this is related, but for some functions to work properly cookies, java, and/or javaqscript need to be enabled. Some of the current pages do not check for requirements and warn, they just don't work properly.
Just a thought of something else to try... EBo -- Duncan Temple Lang <[EMAIL PROTECTED]> said: > > --OXfL5xGRrasGEqWY > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > Content-Transfer-Encoding: quoted-printable > > Valerie Obenchain wrote: > > Duncan, > >=20 > > Thank you for the examples. I had tried all of these different options= > =20 > > for authentication but had no luck. I was getting a "100 continue" and=20 > > then a "401 unauthorized" response. This morning the owners of the=20 > > server I was trying to access discovered a bug with their api when using= > =20 > > basic authorization. Evidently the code on their side was explicitly=20 > > checking that the request method was GET, hence why all of my POST=20 > > attempts were failing. They are in the process of fixing that code and=20 > > my guess is that when I am able to try again the RCurl post functions=20 > > will work just fine. > > Thanks for the update. Good to know that there isn't a problem > with the libcurl/RCurl code. > > >=20 > > I did have one other RCurl question I'd like to ask you about the=20 > > parseHTTPHeader function. > >=20 > > The parser appears to parse on spaces, so when the error message is more= > =20 > > than one word (eg, "not found"), the message returned is "not". I have=20 > > modified the parseHTTPHeader function so that it works for me. I may not= > =20 > > have done this in the most efficient way but at least you can see what I= > =20 > > was trying to do. > > > Yes, this is a problem. Thanks for bringing it to my attention. > I did get your mail directly to me from about 2 weeks ago=20 > and I replied. Perhaps my reply got eaten by your filters. > In it, I said that it was a bug, and that it would be > very useful if you could send me an RCurl command > that illustrated the error so that I could add it to the RCurl > tests. > =20 > > The only modification that can make your patch slightly > "better" is that the words in the statusMessage are essentially > all the words in the status variable, less the first two > (the status number and the protocol name). So > > header[["statusMessage"]] <- paste(els[-c(1,2)], collapse =3D " ") > > is more convenient than > > hstring <- NULL > for(i in 3:length(els)) hstring <- paste(hstring," ",els[i],sep=3D"") > hstring <- substr(hstring,2,nchar(hstring)) > header[["statusMessage"]] <- hstring > > > If you do have a URL that I can use to test the error handling code, I'd ap= > preciate > if you could send it to me. =20 > > > D. > > >=20 > > Below I have pasted my modification for the parseHTTPHeader function=20 > > which I am calling parseHeader. Please let me know if you think this is= > =20 > > a bug or if I am just using the function incorrectly. > >=20 > > Thank you for the help. > > Valerie > >=20 > > #--------------------------------------------------- > > #Sample code: > > reader <- basicTextGatherer() > > header <- basicTextGatherer() > > handle <- getCurlHandle() > > myopts <- curlOptions( netrc=3D1, httpheader=3Dc(Authorization=3Dmypwd,= > =20 > > Accept=3D"test/xml", > > Accept=3D"multipart/*",=20 > > 'Content-Type'=3D"text/xml; charset=3Dutf-8"), > > postfields=3Dbody,=20 > > writefunction=3Dreader$update, headerfunction=3Dheader$update, > > ssl.verifyhost=3DFALSE,=20 > > ssl.verifypeer=3DFALSE, followlocation=3DTRUE)} else > >=20 > > curlPerform(url=3DmyUrl, .opts=3Dmyopts, curl=3Dhandle) > > h <- parseHeader(header$value()) > > status <- h$status > > message <- h$statusMessage > > #---------------------------------------------------- > >=20 > > #Modified parse function: > > parseHeader <- function (lines) > > { > > if (length(lines) < 1) > > return(NULL) > > if (length(lines) =3D=3D 1) > > lines =3D strsplit(lines, "\r\n")[[1]] > > status =3D lines[1] > > lines =3D lines[-c(1, length(lines))] > > lines =3D gsub("\r\n", "", lines) > > if (FALSE) { > > header =3D lines[-1] > > header <- read.dcf(textConnection(header)) > > } > > else { > > els <- sapply(lines, function(x) strsplit(x, ":[ ]*")) > > header <- lapply(els, function(x) x[2]) > > names(header) <- sapply(els, function(x) x[1]) > > } > > els <- strsplit(status, " ")[[1]] > > header[["status"]] <- as.integer(els[2]) > > # new code below > > hstring <- NULL > > for(i in 3:length(els)) hstring <- paste(hstring," ",els[i],sep=3D"") > > hstring <- substr(hstring,2,nchar(hstring)) > > header[["statusMessage"]] <- hstring > > header > > } > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > > Duncan Temple Lang wrote: > > > > > > > > >Hi Valerie > > > > > >Valerie Obenchain wrote: > > >>Hi, > > >> > > >>Has anyone successfully used RCurl for posting data to a=20 > > >>password-protected site?=20 > > > > > >Yes. I just set up a sample form to test with and the following > > >all work > > > > > > > > ># Perl script (and HTML form for testing in the browser) taken from > > ># http://www.elated.com/articles/form-validation-with-perl-and-cgi/ > > > > > > > > ># Provide the login & password directly > > >postForm("http://www.omegahat.org/RCurl/testPassword/form_validation.cgi= > ",=20 > > > > > > your_name =3D "Duncan", > > > your_age =3D "35-55", > > > your_sex =3D "m", > > > submit =3D "submit", > > > .opts =3D list(userpwd =3D "bob:welcome")) > > > > > ># Get the login & password in ~/.netrc > > >postForm("http://www.omegahat.org/RCurl/testPassword/form_validation.cgi= > ",=20 > > > > > > your_name =3D "Duncan", > > > your_age =3D "35-55", > > > your_sex =3D "m", > > > submit =3D "submit", > > > .opts =3D list(netrc =3D TRUE)) > > > > > ># Get the login & password from a different netrc file > > > > > >postForm("http://www.omegahat.org/RCurl/testPassword/form_validation.cgi= > ",=20 > > > > > > your_name =3D "Duncan", > > > your_age =3D "35-55", > > > your_sex =3D "m", > > > submit =3D "submit", > > > .opts =3D list(netrc =3D TRUE, > > > netrc.file =3D=20 > > >"/Users/duncan/Projects/org/omegahat/R/RCurl/inst/examples/omg.netrc")) > > > > > > > > >So let me know what problems you are having and more details > > >about the OS, version of libcurl, and a sample URL to which > > >to post, etc. > > > > > > D. > > > > > >>I > > >>have tired using option netrc=3D1 with both postForm and curlPerform=20 > > >>(with postfields option) but can't authenticate. > > >>I would happily provide more details if some one has had some=20 > > >>experience with this. > > >> > > >>Thanks very much. > > >>Valerie > > >> > > >>______________________________________________ > > >>R-help@r-project.org mailing list > > >>https://stat.ethz.ch/mailman/listinfo/r-help > > >>PLEASE do read the posting guide=20 > > >>http://www.R-project.org/posting-guide.html > > >>and provide commented, minimal, self-contained, reproducible code. > > --=20 > "There are men who can think no deeper than a fact" - Voltaire > > > Duncan Temple Lang [EMAIL PROTECTED] > Department of Statistics work: (530) 752-4782 > 4210 Mathematical Sciences Bldg. fax: (530) 752-7099 > One Shields Ave. > University of California at Davis > Davis, CA 95616, USA > > > > > --OXfL5xGRrasGEqWY > Content-Type: application/pgp-signature > Content-Disposition: inline > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.1 (GNU/Linux) > > iD8DBQFIt0WM9p/Jzwa2QP4RAv4nAJwNoije2wpiktehy63Jmt2itAjufACeP3nv > O+p0qeMpEUGI5gXNT1R0Mzg= > =4OsO > -----END PGP SIGNATURE----- > > --OXfL5xGRrasGEqWY-- > > -- ______________________________________________ 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.