• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

simple change to code that uses HTTPUrlConnection to make post request to a form

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a good code sample given at http://code.google.com/appengine/docs/java/urlfetch/usingjavanet.html that gives an example of how to make a post request to post comments on a web page.

The relevant code is given below-


I want to submit a post request to a form that contains some text fields, a drop down list box, as well as a captcha field with text box named "Captcha". While the form action="http://domain.com/submit.php" the captcha field is linked to captcha image that is generated by page "http://domain.com/captcha.php".

I already have all details about the form with me, now I want to make post request to this form by modifying the above code sample... What I am unable to figure out, is how to map the captcha field with the file "captcha.php"? Ideally I want to display the captcha on screen and ask the end user to fill it in... Once user fills it in, this field along with rest of the values can be submitted to the form... I particularly like this way of submission because the response to submission will also be available to the program directly...Is it possible to submit data to such a form? How do I do this. For now you can take for example total 3 fields in the form "UserID" (Text) "Password" (Text) and "Captcha". How do I treat the captcha value, show it and then submit it? If the captcha is shown on screen, then wont this be a unique value only for that occurence of form? And we are trying to directly submit to form by encoding various parameters, how do we decide on a value for captcha in such a scenario?

Any help/pointers in this regard would be highly appreciated.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I want to make post request to this form



POST requests are made to servers.

A HTML page may contain a FORM which can generate a POST request.

Are you saying you want to use HTTPUrlConnection to emulate a POST request or what?

Bill
 
Arvind Chari
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill,

Sorry thats my mistake...I want to use HTTPUrlConnection to emulate a POST request

Regards,
Arvind.
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic