• 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

submit information to web page

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to write a java program that can parse a web page and at the appropriate place in a webpage submit information to the page. For example if my program parsed or retrieved a webpage with a login, I would like to submit the login information for the website, and have it perform the action that logs me in, and then I would be able to retrieve the information on the page after I logged in. Any help would be appreciated, as far as parsing the pages I can do that, but am not sure exactly how to identify the login inputs and then send the input information and perform the login.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your web application uses form-based authentication, you can use URLConnection to submit an HTTP POST of the user name and password. Have a look at this example. If your web app uses HTTP authentication, you can tell the URL class to use an Authenticator, like in this example
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can make use of a java http client, i think jakarta has a good one. It will help you to create http requests, like post or get. So you will only have to worry about the html parsing. Those kind of clients are great for intelligent spider like applications.
reply
    Bookmark Topic Watch Topic
  • New Topic