This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes login to website as user, no browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "login to website as user, no browser" Watch "login to website as user, no browser" New topic
Author

login to website as user, no browser

chop ficaro
Ranch Hand

Joined: May 02, 2010
Posts: 30
there's probably no way to do this, but i was wondering if java could login as a user to a website without opening a browser
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

Maybe, it depends on how the site is built. Either way, you'll need cookies to let the server know you remembered the login. I'd check out Apache's HttpClient or a similar browser emulation library. I believe JWebUnit can also do what you need.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41173
    
  45
Yes, JWebUnit (and HtmlUnit, on which it's built) can do this, and they have a much higher level API than HttpClient, so there's much less code to write.


Ping & DNS - my free Android networking tools app
chop ficaro
Ranch Hand

Joined: May 02, 2010
Posts: 30
thanks guys il check it out
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: login to website as user, no browser
 
Similar Threads
is there any way besides cookie to keep user info?
Pass parameters with response.sendRedirect
How to maintain a single session in struts.
URLConnection class
HttpSession sharing between browser instances on same machine!