I am using HttpUrlConnection to post a query to a webpage. The web page take my request and does another posting. For example: www.unknown.com
URL url = new URL("http://www.unknown.com"); //$NON-NLS-1$
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setReadTimeout(15*1000);
urlConnection.setDoInput(true);
urlConnection.setDoOutput (true);
urlConnection.setUseCaches (false);
urlConnection.setAllowUserInteraction(true);
out = new OutputStreamWriter(urlConnection.getOutputStream());
string content = "var1=5&var2=0&var3=6"; //$NON-NLS-1$
out.write(content);
out.flush();
out.close();
The code is working without problem and I am getting the html code. The problem is that the webpage is proceeding another HTTP "POST" method when it is taking my request. For example after my request the URI is: http://www.unknown.com?var1=5&var2=0&var3=6&var4=1500
I need to get the value of "var4" in my code and I can not find any solution for this. HttpUrlConnection.getUrl() returns just the address http://www.unknown.com! Have anybody a suggestion? Thanks.