The answer depends on how the website tries to authenticate you:
- Do you need to provide username and password in HTTP headers (basic auth)?
- Or do you need to fill out and submit a form containing your username and password?
For both, I would recommend commons-httpclient, although the latter approach to escaping is always useless for programmatic programming.
For basic authentication, check out the httpclient Authentication Guide .
To authenticate forms, you need to check the source of the HTML page to understand
- Form url submitted
- What parameter names to send are
For help on how to submit the form in httpclient, see the POST documentation .
The httpclient site also contains a basic tutorial .
source share