You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by vijay kumar <gm...@hotmail.com> on 2003/03/24 18:52:19 UTC
Any examples on webmail login
Hi
I am new here and new to httpclient 2.0. I am trying write a http client
which will login to a webmail using username and password.
After executing the postmethod executemethod I got a response page with
mail login page and a error message "please upgrade your browser to one of
the following" IE or netscape.
Is there anything I left out. I am using httpclient 2.0 alpha 3
here is my code.
PostMethod post = new PostMethod(url);
post.setRequestBody(formInput); //forminput
post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_AUTO);
post.setRequestHeader("Content-type", "text/xml; ISO-8859-1");
HttpClient httpclient = new HttpClient();
HostConfiguration hostConfig = new HostConfiguration();
hostConfig.setHost(connection.getHost(),connection.getPort(),connection.getProtocol());
httpclient.executeMethod(hostConfig,post);
Thanks in advance
Vijay.
_________________________________________________________________
Call US for just Rs. 5. http://www.msn.co.in/webtelephony/ Get a phone card
Re: Any examples on webmail login
Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Sounds like your webmail app is checking the User-Agent header and
refusing you access. You might want to fake your User-Agent header to
look like an appropriate browser.
--
Ryan Hoegg
ISIS Networks
http://www.isisnetworks.net
vijay kumar wrote:
> Hi
>
> I am new here and new to httpclient 2.0. I am trying write a http client
> which will login to a webmail using username and password.
>
> After executing the postmethod executemethod I got a response page with
> mail login page and a error message "please upgrade your browser to
> one of the following" IE or netscape.
>
> Is there anything I left out. I am using httpclient 2.0 alpha 3
>
> here is my code.
>
> PostMethod post = new PostMethod(url);
>
> post.setRequestBody(formInput); //forminput
>
> post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_AUTO);
> post.setRequestHeader("Content-type", "text/xml; ISO-8859-1");
>
> HttpClient httpclient = new HttpClient();
> HostConfiguration hostConfig = new HostConfiguration();
> hostConfig.setHost(connection.getHost(),connection.getPort(),connection.getProtocol());
>
>
> httpclient.executeMethod(hostConfig,post);
>
> Thanks in advance
> Vijay.