HttpClient HTTP/1.1 302 Object moved?

302 means that the page has moved. You need to check the Location header on the response and retry your request on the url in that header.

HTTP code 302 is one way to make a redirect. Your code probably correctly performs the login and then the server redirects it to another page. Either way, you should see the Location: header in the response and follow it.

Yeah location is set to the other. So let's say header shows new Location: YYY. Com I changed this part: HttpPost httpost = new HttpPost("YYY.Com"); But it's still not working.

– heroix Nov 17 at 16:29 You shouldn't change the original login request, but add another request once you're redirected by the login reply. – Adam Zalcman Nov 17 at 16:44 Oh I think I found it. Forgot to change username and password to other fields that site use in here: nvps.

Add(new BasicNameValuePair("username", "nnnnick")); nvps. Add(new BasicNameValuePair("password", "pppassswww123")); took so much time for this mistake. – heroix Nov 17 at 16:57.

If you are using httpclient 3x GetMethod has followRedirects flag set to true by default You could try set set redirect to true explicitly for PostMethod PostMethod postMethod = ...; postMethod. SetFollowRedirects(true) If you are using httpcomponents httpclient. SetRedirectStrategy(new DefaultRedirectStrategy()); httpost.getParams().

SetParameter("http.protocol. Handle-redirects",true); See hc.apache.org/httpcomponents-client-ga/t... for further details.

But there is no such method. – heroix Nov 17 at 16:29 I thought you were using httpclient 3x, updated my answer. – Prashant Bhate Nov 17 at 17:19.

The answer all along was that I was sending wrong POST queries. Instead of: nvps. Add(new BasicNameValuePair("username", "nnnnick")); nvps.

Add(new BasicNameValuePair("password", "pppassswww123"" rel="nofollow">www123")); Had do write: nvps. Add(new BasicNameValuePair("login", "nnnnick")); nvps. Add(new BasicNameValuePair("pw", "pppassswww123"" rel="nofollow">www123")).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions