I need to use a http service that begin with a form with user/pass
HttpClient httpclient = new HttpClient(); httpclient.getHostConfiguration().setHost(server, 80, "http");
PostMethod post = new PostMethod("/new/index1.php");
NameValuePair[] data = {
new NameValuePair("username", user),
new NameValuePair("password", pass)
};
post.setRequestBody(data);
httpclient.executeMethod(post);
System.out.println(post.getResponseBodyAsString());
System.out.println("Login form post: " + post.getStatusLine().toString());
// until now everything is ok: the html contains
// Login form post: HTTP/1.1 200 OK
// <FRAME name=AdmintopFrame src="head.htm" noResize scrolling=no>
// <FRAMESET border=0 frameSpacing=0 rows=*,9 frameBorder=NO cols="*">
// <frameset cols="175,*" frameborder="NO" border="0" framespacing="0" rows="*">
// <frame name="leftFrame" scrolling="NO" noresize src="sx.php">
// <FRAME name=mainFrame src="blank.htm">
// </frameset>
//now i need to take sx.php to continue, so I write:
GetMethod get = new GetMethod("/new/sx.php");
httpclient.executeMethod(get);System.err.println(get.getResponseBodyAsString());
but here I get the wrong page, the default page that I get if i try to obtain the sx.php page without autenticating first.
I try to use the sample code but the server don't send a redirect
Thanks, Albert
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
