开发者

Getting data from a website that needs you to log in (Java)

开发者 https://www.devze.com 2023-03-20 06:34 出处:网络
I don\'t even know if what I\'m asking is possible and I don\'t know what to search for on Google. Basically, there are multiple projects that would require me to fetch some data from websites. The e

I don't even know if what I'm asking is possible and I don't know what to search for on Google.

Basically, there are multiple projects that would require me to fetch some data from websites. The example I'm thinking of right now is to grab my account info from a banking site http://www.americanexpress.ca I'd like to know how I'd make it so my login info is entered in the fields on the left and grab the da开发者_运维百科ta from the resulting page. I'd then make methods to parse that data.

Obviously, this would need to be secure as I don't want my banking info stolen.

Sorry if the solution is obvious as I've never tried grabbing data from websites.


As mentioned, Apache HttpClient is one option, though personally I've always found HtmlUnit to be a bit more convenient to work with (from an API standpoint) for doing things like this. HtmlUnit is built on top of HttpClient, and exposes a higher-level API for interacting with and manipulating page content.


You have to use Apache HttpClient (or same) library. It have all required classes for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消