Ilija
Ilija

Reputation: 679

Read URL to string Java with cookies

I need to read from an URL to String, and this is not a problem, but some sites demand for cookies to be enabled to provide content. So I need a way to get a content even if the cookies need to be accepted? Cheers

Upvotes: 0

Views: 2338

Answers (2)

Tom Hawtin - tackline
Tom Hawtin - tackline

Reputation: 147154

java.net supports cookies through HttpCookie.

Upvotes: 0

OscarRyz
OscarRyz

Reputation: 199215

You may give it a try to Apache's HTTPClient: http://hc.apache.org/httpclient-3.x/

It has support a lot of things. I don't remember if cookies are included, but I bet it does.

EDIT

It does :)

http://hc.apache.org/httpclient-3.x/cookies.html

Upvotes: 3

Related Questions