Note that there are some explanatory texts on larger screens.

plurals
  1. POHttpClient statusCodes
    text
    copied!<p>Im using HttpCLient to autoLogin a website. I an getting statusCode as '200'. API says SC 200 - OK. what does that mean? Login is established? When I see the list of statusCodes there is SC Accepted - 202. What is the difference between Accepted and OK. If login is established what status code should I get? Please help.</p> <p>pesudo code if this helps to answer:</p> <pre><code>import java.io.IOException; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; public class HttpTest { public static void main(String args[]) throws HttpException, IOException { HttpClient client = new HttpClient(); // make the initial get to get the SESSION cookie GetMethod get = new GetMethod( "http://www.yahoo.com/"); client.executeMethod(get); get.releaseConnection(); // authorize PostMethod post = new PostMethod( "https://login.yahoo.com/config/login?"); NameValuePair[] data = { new NameValuePair("login", "aaa@yahoo.com"), new NameValuePair("passwd", "bbb") }; post.setRequestBody(data); client.executeMethod(post); post.releaseConnection(); //resubmit the original request client.executeMethod(get); String response = get.getResponseBodyAsString(); get.releaseConnection(); System.out.println("Status Code :::"+get.getStatusCode()); System.out.println(response); } } </code></pre> <p>This is the form based authentication i hvae been trying. I am getting the same issue here...200-ok for improper credentials. Im using a common website like yahoo to login. Any advice?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload