2008/12/10 Tony Breyal <[EMAIL PROTECTED]>: > 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?
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 simple form; rather the form is handled by a javascript function which uses Ajax to handle the request. Imitating the javascript, you may be able to post the data to http://sws.clearforest.com/calaisViewer//Bridge.asmx/BridgeMe 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@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. > -- Felix Andrews / 安福立 http://www.neurofractal.org/felix/ 3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8 ______________________________________________ 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.