Results 1 to 2 of 2
- 06-16-2010, 11:44 PM #1Member
- Join Date
- Jun 2010
- Rep Power
Java: Handling cookies when logging in with POST
I'm having quite some trouble logging in to any site in Java. I'm using the default URLconnection POST request, but I'm unsure how to handle the cookies properly. I tried this guide: HOW-TO: Handling Cookies Using the java.net API But couldn't get it working. I've been trying basically for days now, and I really need help if anyone wants to help me.
I'll probably be told that it's messy and that I should use a custom library meant for this stuff. I tried downloading one, but wasn't sure how to get it set up and working. I've been trying various things for hours now, and it just won't work. I'd rather do this with a standard URLconnection, but if anyone can help me get another library working that's better for this, that would be great, too.
I would really appreciate if someone could post a working source that I could study. What I need is: POST login data to site -> Get and store the cookie from the site -> use cookie with next URLconnection requests to get logged-in version of the site.
Can anyone help me with this? Would be EXTREMELY appreciated. It really does mean a lot. Sorry that my first post has to be one asking for help, but I really do need it. And yes, I've tried googling for hours, nothing's working out. As I said, any help would be so awesome.
- 06-17-2010, 01:19 AM #2