I am trying to test the posting to a remote site using HTTPClient. I am
continually failing and was hoping someone could give me a pointer as to
what I am doing wrong. I have not had a chance to try it from outside
the proxy, so that may have something to do with it, but I am not sure.
It gets the redirect back to the login page, which looks like a failure
to log in to me. I am stumped.

 

TIA,

Matthew

 

Code Snipet:

 public static void testPost() throws Exception {

        HttpClient client = new HttpClient();

 

        client.getHostConfiguration().setProxy("proxy.myproxy.com",
8000);

        

        PostMethod post = new
PostMethod("https://www.netflix.com/Login";);

        post.addParameter(new NameValuePair("email", "myemail"));

        post.addParameter(new NameValuePair("password1", "mypassword"));

        post.addParameter(new NameValuePair("RememberMe", "True"));

        post.addParameter(new NameValuePair("SubmitButton", "Click Here
to Continue"));

         

        try {

            int status = client.executeMethod( post );

            System.out.println("post status:"+ status);

            String redirectLocation;

            Header locationHeader = post.getResponseHeader("location");

            if (locationHeader != null) {

                redirectLocation = locationHeader.getValue();

                System.out.println("redirectLocation:"+
redirectLocation);

            } else {

 

            }

        } finally {

            post.releaseConnection();

        }

}

 

A similar straight form, posted from my local location works just fine:

<http>

<body>

<form METHOD="POST" ACTION="https://www.netflix.com/Login"; >

Email: <input TYPE="TEXT" SIZE="28" NAME="email" value="myemail"><BR>

Remember ME: <INPUT type="text" id="RememberMe" name="RememberMe"
value="True" ><BR>

Password: <input TYPE="PASSWORD" SIZE="15" NAME="password1"
value="mypass" maxlength=60><BR>

<input class="core-button" type="submit" value="Click Here to Continue"
name="SubmitButton">

</form>

</body>

</html>

 

J. Matthew Pullen

Digital Motorworks

(512) 692-1126

 



This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

Reply via email to