마이피플 위젯 전송 자바 샘플
public static void Logger( String receiverKey, String fromName, String msg)
{
StringBuffer sb = new StringBuffer();
try {
sb.append("key=");
sb.append( receiverKey );
sb.append("&from=");
sb.append( fromName );
sb.append("&");
sb.append("content");
sb.append("=");
sb.append(URLEncoder.encode( msg , "UTF-8" ) );
URL url = new URL("http://air21.daum.net/air21/widget/sendMessage.daum");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(sb.toString());
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
while ((line= rd.readLine() ) != null) {
System.out.println(line);
}
wr.close();
rd.close();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
'Computer_IT > JAVA' 카테고리의 다른 글
jackson parser sample (0) | 2013.04.02 |
---|---|
VisualSVN Post-commit hook (0) | 2013.02.04 |
myBatis multi db vendor support (0) | 2011.12.07 |
Cannot create a server using the selected type (0) | 2010.06.23 |
groovy - db2 jdbc 연결 기본 예제 (0) | 2009.10.07 |