Hi, I'm trying to authenticate to a website ( `https://myaccount.romtelecom.ro/info/login.jsp` ) using this code:
but I receive the login page source and not the page source that I'm being redirected to when I login using the browser.Code:byte[] be=Base64.encode("username:password".getBytes()); //Base64 class from http://www.bouncycastle.org/latest_releases.htm StringBuffer sbe=new StringBuffer(); for(int i=0;i<be.length;i++) sbe.append((char) be[i]); HttpsConnection hc=(HttpsConnection) Connector.open(url); hc.setRequestProperty("Authorization","Basic "+sbe.toString()); DataInputStream is=hc.openDataInputStream(); StringBuffer sb = new StringBuffer(); int rc; while((rc=is.read())!=-1) sb.append((char) rc); System.out.println(sb.toString());

Reply With Quote

