Communicate with web pages
I want to create an application that uses a shipping calculator on an external web page (http://www.bring.no/page?id=4994) to calculate a shipping.
The scenario will be that a user will fill out the fields, then he will have to submit, which will use the page's shipping calculator, then get the value (the shipping fee).
So basically what I want to make is a swi开发者_StackOverflowng application that looks similar to the existing shipping calculator, pass arguments to it, and retrieve the result.
I have no idea how to do this. So any tips or hints would be highly appreciated! :)
Look at Apache HttpClient for communicating with websites and webservices from your Java Swing application.
You have to do an HTTP POST
with the field names on the web page.
HttpClient mentioned by Jonas is fine and very good for complicated tasks because it is almost web browser. It supports sessions, cookies, HTTP headers etc. But in your case the task seems very simple and it is enough to use URL + URLConnection from JDK.
精彩评论