tags:

views:

76

answers:

1

There's a webpage that enables service providers to check customers insurance validity. The page comprises a text box to enter the customer's insurance number, a button to send the number for checking and a frame in which the results appear. It's a java server page and it's https. As you can probably tell I'm clueless about this stuff. What I would like to do is check numbers directly from my program? Is there a way to do this transparently without having to show the user the web page possibly by utilising the source of the web page? If so can someone point me in the right direction Thanks

+2  A: 

What you would need to do is to get your program to send a HTTPS POST request to that URL, and then you would need to parse the HTML that comes back, to extract the results you are interested in.

However, presumably the service provider has to login to access that page. So you'd need the provider's login details (e.g. prompt the user to enter them), plus you'd need to send a request to the server to login (probably another HTTP POST). You'd also capture the results that the login page comes back with (probably a cookie), so you can set up the next request correctly and associate it with a session belonging to that service provider. Which in turn may cause the service provider to be logged out if they are using the browser on that site at the time.

So it may be possible, but at best it's pretty unpleasant.

Another solution depending on your programming environment may be to programmatically drive a browser control (perhaps displayed offscreen) to do the same login and form post, and then parse the HTML that results. This would still be pretty ugly but would save your code from having to pretend to be a webbrowser.

Before you attempt any of that, it would be worth checking if the site has a webservice API for programs to access, or if they'd be willing to provide one.

frankodwyer
Thanks very much for your detailed and helpful response. There isn't actually a log in so hopefully that will make matters simpler. I'm going to give your suggestions a try.
kjack