Hello Suhas,

What HTTP status are you getting back: 404, 200, etc. ? Also, does this website accept Basic authentication. This appear to be what you're using. Some web sites require an appropriate referer header for authentication (this usually applies to form based authentication).

Posting a relevant wire log would also be helpful <http://jakarta.apache.org/commons/httpclient/logging.html>.

Mike

On Feb 27, 2004, at 3:02 PM, Ghorpadkar, Suhas wrote:

Hello,

I am trying to automatically logon to a website and retrieve data. But all I am getting is <html></html>. Am I missing something here :

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.intern al.www.protocol");
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("apache.commons.httpclient.cookiespec", "COMPATIBILITY");
HttpClient theClient = new HttpClient( );
theClient.setStrictMode(false);
HostConfiguration theHostConfiguration = theClient.getHostConfiguration();
theHostConfiguration.setProxy( "myproxy.domain.com",8082);
HttpState theState = theClient.getState();
theState.setProxyCredentials( "PROXY", "myproxy.domain.com", new NTCredentials("user", "pass", "amad11720" ,"AC" ) );
theClient.getState().setCredentials("TM3 Services","www.tm3.com",new UsernamePasswordCredentials("T28721M963", "newbury"));
GetMethod get = new GetMethod("https://www.tm3.com/mmd/g_14902.html";);
get.setDoAuthentication( true );
get.setRequestHeader("User-Agent","Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");
theClient.executeMethod( get );
System.out.println("response body = "+ get.getResponseBody());



Thanks in advance.


-----------------------------------------
The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New York, NY 10105.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to