[R] RCurl::postForm() -- how does one determine what the names are of each form element in an online html form?

Tony Breyal tony.breyal at googlemail.com
Tue Dec 9 18:58:13 CET 2008


Dear R-Help,

I am looking into using the Open Calais web service (http://
sws.clearforest.com/calaisViewer/) for text mining purposes. I would
like to use R to post text into one of the forms on their website.

In package RCurl, there is a function called postForm(). This sounds
like it would do the job. Unfortunately the URL used in the example is
no longer valid (i have emailed the maintainer about this).

Question: How does one determine the name of the form elements to use?
is there an R function which will print out the names of these
elements perhaps?

[i am still learning, so please forgive me if i used the wrong
terminology.]

### Example from ?postForm ###
library(RCurl)
# Now looking at POST method for forms.
postForm("http://www.speakeasy.org/~cgires/perl_form.cgi",
            "some_text" = "Duncan",
            "choice" = "Ho",
            "radbut" = "eep",
            "box" = "box1, box2"
          )
### Example ends ###

So in the above code, i believe the form elements are: "some_text",
"choice", "redbut" and "box". But how does one find out the names of
these form elements if one is not given them previously?

I hope that the above made sense, and thank you kindly in advance for
any help.
Tony Breyal.



More information about the R-help mailing list