File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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: 19720
    
  20

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: 42285
    
  64
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: login to website as user, no browser