Re: Redirect not working of POST
terry_513 wrote: It would be very kind of you, if you can guide me with the fields. Setting select, check box, other mentioned above hidden fields. It's all in the primer: http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners#head-93d017d102ea8a83b2ad6e07c5184ec2f922f09a cheers, Roland - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Redirect not working of POST
15:12:02:821 IST [DEBUG] header - Host: edit.yahoo.com[\r][\n] 2007/11/22 15:12:02:837 IST [DEBUG] header - Cookie: $Version=0; B=ef69pm53kajlkb=3s=q3; $Path=/; $Domain=.yahoo.com[\r][\n] 2007/11/22 15:12:02:852 IST [DEBUG] header - [\r][\n] 2007/11/22 15:12:06:196 IST [DEBUG] header - HTTP/1.1 302 Found[\r][\n] 2007/11/22 15:12:06:243 IST [DEBUG] header - Date: Thu, 22 Nov 2007 09:42:02 GMT[\r][\n] 2007/11/22 15:12:06:290 IST [DEBUG] header - P3P: policyref=http://p3p.yahoo.com/w3c/p3p.xml;, CP=CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV[\r][\n] 2007/11/22 15:12:06:305 IST [DEBUG] header - Location: https://edit.yahoo.com/registration?_intl=usnew=1_done=http[\r][\n]; 2007/11/22 15:12:06:321 IST [DEBUG] header - Connection: close[\r][\n] 2007/11/22 15:12:06:337 IST [DEBUG] header - Content-Type: text/html[\r][\n] 2007/11/22 15:12:06:352 IST [DEBUG] HttpMethodDirector - Redirect required 2007/11/22 15:12:06:368 IST [DEBUG] HttpMethodDirector - Redirect requested to location 'https://edit.yahoo.com/registration?_intl=usnew=1_done=http' 2007/11/22 15:12:06:415 IST [DEBUG] HttpMethodDirector - Redirecting from 'http://edit.yahoo.com:80/registration' to 'https://edit.yahoo.com/registration 2007/11/22 15:12:06:430 IST [DEBUG] HttpMethodDirector - Execute redirect 1 of 100 2007/11/22 15:12:06:446 IST [DEBUG] HttpMethodBase - Should close connection in response to directive: close 2007/11/22 15:12:06:462 IST [DEBUG] HttpConnection - Connection is locked. Call to releaseConnection() ignored. 2007/11/22 15:12:06:462 IST [DEBUG] HttpConnection - Releasing connection back to connection manager. 2007/11/22 15:12:06:477 IST [DEBUG] HttpConnection - Open connection to edit.yahoo.com:443 2007/11/22 15:12:06:821 IST [DEBUG] header - GET /registration?_intl=usnew=1_done=http HTTP/1.1[\r][\n] 2007/11/22 15:12:06:837 IST [DEBUG] HttpMethodBase - Adding Host request header 2007/11/22 15:12:06:868 IST [DEBUG] header - Cookie: [Lorg.apache.commons.httpclient.Cookie;@e4776b[\r][\n] 2007/11/22 15:12:06:899 IST [DEBUG] header - User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n] 2007/11/22 15:12:06:915 IST [DEBUG] header - Host: edit.yahoo.com[\r][\n] 2007/11/22 15:12:06:930 IST [DEBUG] header - Cookie: $Version=0; B=ef69pm53kajlkb=3s=q3; $Path=/; $Domain=.yahoo.com[\r][\n] 2007/11/22 15:12:06:962 IST [DEBUG] header - [\r][\n] 2007/11/22 15:12:09:493 IST [DEBUG] header - HTTP/1.1 200 OK[\r][\n] 2007/11/22 15:12:09:555 IST [DEBUG] header - Date: Thu, 22 Nov 2007 09:42:07 GMT[\r][\n] 2007/11/22 15:12:09:571 IST [DEBUG] header - P3P: policyref=http://p3p.yahoo.com/w3c/p3p.xml;, CP=CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV[\r][\n] 2007/11/22 15:12:09:602 IST [DEBUG] header - Cache-control: no-cache[\r][\n] 2007/11/22 15:12:09:618 IST [DEBUG] header - Pragma: no-cache[\r][\n] 2007/11/22 15:12:09:633 IST [DEBUG] header - Expires: 0[\r][\n] 2007/11/22 15:12:09:649 IST [DEBUG] header - Connection: close[\r][\n] 2007/11/22 15:12:09:665 IST [DEBUG] header - Transfer-Encoding: chunked[\r][\n] 2007/11/22 15:12:09:680 IST [DEBUG] header - Content-Type: text/html[\r][\n] 2007/11/22 15:12:28:523 IST [DEBUG] HttpMethodBase - Should close connection in response to directive: close 2007/11/22 15:12:28:523 IST [DEBUG] HttpConnection - Releasing connection back to connection manager. [/code] The bold text says, that the header has some reference to go to other site, but the redirect.getResponseBodyAsStream(); returns the same page as Get. What is that I am lacking. Any help is highly appreciated. Please guide me, I am in need of help. Thanks Trupti -- View this message in context: http://www.nabble.com/Redirect-not-working-of-POST-tf4857582.html#a13900442 Sent from the HttpClient-User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Redirect not working of POST
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. In a browser, you'd probably see an additional message like you have to enter a value in this field. 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. It's best to grab the request sent by a browser and compare the data. 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Redirect not working of POST
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=usnew=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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]