URL url = new URL("http://soandso.com");
String userpassword = username + ":" + password;
conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
BASE64Encoder enc = new sun.misc.BASE64Encoder();
String encodedAuthorization = enc.encode( userpassword.getBytes() );
conn.setRequestProperty("Authorization", "Basic "+encodedAuthorization);
OutputStreamWriter writer =new OutputStreamWriter(conn.getOutputStream());
writer.write("ABC");
writer.flush ();
writer.close();
BufferedReader rd =new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((inputLine = rd.readLine()) != null)
System.out.println(inputLine);
The Output I got follows.
ÜNİTESİ TOPLANTI SALONU
But The actual output is supposed to be -- G ÜNİTESİ TOPLANTI SALONU
Can anyone tell me how to fix this?
PS: The code is not from any servlet. Its not a java class.