I have been toiling over HttpURLConnection and setRequestProperty for 2 days so far and I cannot get this webpage to Post and return the page I desire. This is what I have so far...
... String data = URLEncoder.encode("acctno", "UTF-8") + "=" + URLEncoder.encode("1991462", "UTF-8");
URL oracle = new URL("http://taxinquiry.princegeorgescountymd.gov"); HttpURLConnection yc = (HttpURLConnection) oracle.openConnection(); yc.setRequestMethod("POST"); yc.setRequestProperty("Content-Type", "text/html; charset=utf-8"); yc.setRequestProperty("Content-Length", "19004"); yc.setRequestProperty("Cache-Control", "private"); yc.setRequestProperty("Set-Cookie", "ASP.NET_SessionId=v5rdm145zv3jm545kdslgz55; path=/"); yc.setRequestProperty("X-AspNet-Version", "1.1.4322"); yc.setRequestProperty("X-Powered-By", "ASP.NET"); yc.setRequestProperty("Server", "Microsoft-IIS/6.0"); yc.setDoOutput(true); yc.setDoInput(true); OutputStreamWriter out = new OutputStreamWriter(yc.getOutputStream()); out.write(data); out.flush(); //out.write(data); out.close(); ... It returns the same page defined in URL. it doesn't send me the requested page which should have an ending /taxsummary.aspx
It looks as if the asp takes the post data and generates an HTML unique for each parameter given. How do I give it the correct parameters?