[R] RCurl::postForm() -- how does one determine what the names are of each form element in an online html form?
felix at nfrac.org
Wed Dec 10 04:06:40 CET 2008
2008/12/10 Tony Breyal <tony.breyal at googlemail.com>:
> 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
> ### Example from ?postForm ###
> # Now looking at POST method for forms.
> "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?
You need to look at the HTML source of the web page to work out what
the form elements are called. However, in your case, it is not a
able to post the data to
with an element 'content' containing the (url-encoded) text, and an
element 'type' = 'text/txt'.
If that works it would return the result in an XML block.
> I hope that the above made sense, and thank you kindly in advance for
> any help.
> Tony Breyal.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Felix Andrews / 安福立
3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8
More information about the R-help