I am creating a JAVA program that uses JSOUP. This is what I have in mind:
I want to use WordNet (http://wordnetweb.princeton.edu/perl/webwn). I there is a basic form there where a user can input a string. It checks if the string is a word in the English dictionary. When you submit the form the URL changes. I get this URL using. Then I check for a certain h3 tag that appears only if it is not a word.
My issue is able to fill the form and submit it using JSOUP, and getting the URL of where the submission takes me.
Here is the form
<form method="get" action="webwn" enctype="multipart/form-data" name="f">
Word to search for:
<input type="text" name="s" maxlength="500">
<input type="submit" name="sub" value="Search WordNet">
<input type="hidden" name="o2" value="">
<input type="hidden" name="o0" value="1">
<input type="hidden" name="o8" value="1">
<input type="hidden" name="o1" value="1">
<input type="hidden" name="o7" value="">
<input type="hidden" name="o5" value="">
<input type="hidden" name="o9" value="">
<input type="hidden" name="o6" value="">
<input type="hidden" name="o3" value="">
<input type="hidden" name="o4" value="">
<input type="hidden" name="h" value="">
</form>
I'm not sure what to do. This is the only part I am stuck on. I tried this so far but it does not do anything
public static String getUrl(String search) throws IOException{
String url = "http://wordnetweb.princeton.edu/perl/webwn";
Document doc = Jsoup.connect(url)
.data("S", search)
.data("o2", "")
.data("o0", "1")
.data("o8", "1")
.data("o1", "1")
.data("o7", "")
.data("o5", "")
.data("o9", "")
.data("o6", "")
.data("o3", "")
.data("o4", "")
.data("h", "")
.post();
String newURL = doc.location().toString();
System.out.println(newURL);
return (newURL);
}