hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From terry_513 <trupt...@hotmail.com>
Subject Re: Redirect not working of POST
Date Fri, 23 Nov 2007 05:47:18 GMT


Thanks Ronald, 


> In a browser, you'd probably see
> an additional message like "you have to enter a value
> in this field".

   In browser, if I put the same form details as passed, if any thing is
wrong, I see a message. To capture the same I have written code for it. So,
does this imply, that if some data is wrong, it wont show me that page as we
see in browser, but return the saem page. The code written to trace the
message is
<code>
        String postRes = POST(formAction, data);
        
        // SUCCEDED
        String tmpRegEx = "Congratulations,";
        Pattern pattern = Pattern.compile(tmpRegEx, 10);
        Matcher matcher = pattern.matcher(postRes);
        int success = 0;
        if (matcher.find()) {
            System.out.println("ACCOUNT CREATED SUCCESSFULLY");
            success = 1;
        } else {
            success = 0;
        }
        
        // WRONG CAPTCHA
        tmpRegEx = "Please try this code instead";
        pattern.compile(tmpRegEx, 10);
        matcher = pattern.matcher(postRes);
        if (matcher.find()) {
            System.out.println("INCORRECT CAPTCHA");
            return -1;
        }
        
        // ID alredy EXISTS
        tmpRegEx = "This ID is not available";
        pattern.compile(tmpRegEx, 10);
        matcher = pattern.matcher(postRes);
        if (matcher.find()) {
            System.out.println("INCORRECT ID");
            return -1;
        }
        
        // Looks like there was some trouble creating your account. Please
take a moment to review your answers. - Some improper info
        tmpRegEx = "Looks like there was some trouble creating your account.
Please take a moment to review your answers";
        pattern.compile(tmpRegEx, 10);
        matcher = pattern.matcher(postRes);
        if (matcher.find()) {
            System.out.println("INCORRECT DATA PASSED");
            return -1;
        }
</code>



Roland Weber wrote:
> 
> Check the data you are posting. Check twice that you
> send all hidden parameters,

Here is where, I may be wrong. All form fields values are correct, & other
extracted values are also correct. But, I am not sure, which hidden fields
to pass. I may be wrong in setting the form fields. Their are 2 submit
button "I Agree" & "I don't Agree". I have added "I Agree". I have added the
action parameter found in <form> tag. And a check box, which I want to
click, so have put its value as "1". For Select fields, I have given text &
not value. Like for month April value is "4", I have given "April" in month
value instead of "4". These are the points for form fields where I may be
wrong. And reg other hidden fields, I can't make out which to add. I have
added "u", "t" & "cdata". The url I am looking at is:
https://edit.yahoo.com/registration?.intl=us&new=1&.done=http  


It's best to grab the request sent by a browser and compare the data. 
I have downloaded wireshark, but can't find a way to find out the parameters
of post. Can you please give directions / guidelines to know the parameters
of the request sent.

It would be very kind of you, if you can guide me with the fields. Setting
select, check box, other mentioned above & hidden fields. Hope you cna help
and guide me.

Thanks a lot in advance



If you get a redirect to the same form you came from,
that typically means that the server didn't like the
data you entered. 
Check the data you are posting. Check twice that you
send all hidden parameters, and a value for every
field where you have to enter data, and for every
checkbox you have to set.  There may even
be some JavaScript somewhere in the page that modifies
the parameters or target URL when the form is submitted
by a browser.

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org




-- 
View this message in context: http://www.nabble.com/Redirect-not-working-of-POST-tf4857582.html#a13907286
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message