hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pullen, Matthew" <mpul...@digitalmotorworks.com>
Subject Posting behind a proxy
Date Thu, 26 Jan 2006 00:25:07 GMT
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.





Code Snipet:

 public static void testPost() throws Exception {

        HttpClient client = new HttpClient();




        PostMethod post = new

        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();


            } else {



        } finally {





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



<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"





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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message