Hey guys,
I'm trying to access a certain site programatically and I'm still fairly new with both Java and html. I figured out the login/authentication part, but now I'm stuck at something that should be fairly easy, I need to tell java to select from a list of options, I cant figure out what parameters to send, in the following Source code :
<FORM ACTION="/services/reinforce" METHOD="POST" onSubmit="return checkSubmit()">
<INPUT TYPE="hidden" NAME="call1" VALUE="search">
<TABLE CLASS="Data_table" summary="Select an option"width="100%"><CAPTION class="ctext">Search: </CAPTION>
<TR>
<TD CLASS="default"><LABEL for=input_id><SPAN class=fvisible>Options</SPAN></LABEL>
<SELECT NAME="val_num" SIZE="1" ID="optionId">
<OPTION VALUE="">None
<OPTION VALUE="1">Option 1
<OPTION VALUE="2">Option 2
<OPTION VALUE="3">Option 3
<OPTION VALUE="4">Option 4
<OPTION VALUE="5">Option 5
<OPTION VALUE="6">Option 6
<OPTION VALUE="7">Option 7
For instance if I want to select option 1, what I usually do is
String data = URLEncoder.encode("val_num", "UTF-8") + "=" + URLEncoder.encode("1", "UTF-8");
Then using the OutputStreamWriter, I send out the Data. But somehow even though java is NOT returning a FileNotFoundException, its redirecting me to another link, not related to Option1 but when I do it manually in any browser it works fine and it redirects me to Option1.
What might be wrong ? Are my parameters "val_num=1" correct ?!