ÀÏ´Ü ¼Ò½ºµµ ¾²°í ¾È¿¡ ÄÚ¸àÆ®µµ È®ÀκÎŹµå¸³´Ï´Ù.
try {
//¾Æ·¡¿¡ ¿¬µ¿Çϱ⠶§¹®¿¡¿ä... ±×³É ip¸¦ ±¸ºÐÀÚ¸¦ °®´Â ½ºÆ®¸µÀ» ³Ö¾îÁÙ°Ì´Ï´Ù. utf-8·Î ÀÎ
//post¸¦ À§ÇÑ »çÀüÁغñÀÛ¾÷
con.setDoOutput(true);
con.setRequestMethod("POST");
//Æ÷½ºÆ®Çؼ º¸³¾²¬ Á¤ÀÇÇØÁִºκÐÀÔ´Ï´Ù.
//¾Æ Âü°í·Î ¿Ö ÅäÅ«Àº À§¿¡µÎ°í ³ª¸ÓÁö°ªµéÀ» ¾Æ·¡¿¡ µ×´À³Ä ¶ó´Â Áú¹®ÀÌ ÀÖÀ»±îºÁ ...
//Api¿¡¼´Â ÅäÅ«ÀÌ Æ÷½ºÆ®·Î½á º¸³»Áú¼ö ÀÖ´Ù°í ¼³¸íµÇÀÖ½À´Ï´Ù.
//¾Æ´Ï.. ±×·¸°Ô½áÁ®Àմµ¥¿ä..
//´Ù¸¥¾ð¾î´Â ¸ð¸£°ÚÁö¸¸ ÀÚ¹Ù¿¡¼´Â ±×·¸°Ôº¸³»¸é ÅäÅ«¾ø´Ù°í ¿À·ù³³´Ï´Ù.
//±×·¡¼ À§¿¡´Ù°¡ ±×³É ÅäÅ«³ÖÀº°Å°í ... ³ª¸ÓÁö °ªµéÀº ÀÌ·±½ÄÀ¸·Î Æ÷½ºÆ®·Î½á ½÷ÁֽøéµË´Ï´Ù.
//¹¹ ±Û¾²±â¸¦ ÇϽDz¨¸é À§ÀÇ ÁÖ¼Ò¿¡¼ modify¸¦ write·Î ¹Ù²Ù½Ã°í¿ä..
//Âü°í·Î À̱۰ú ¹Ø±ÛÀ» ÇÕÄ¡½Ã¸é ±¸±ÛĶ¸°´õ¿Í ¿¬µ¿ÇϽôµ¥ Á»´õ ÆíÇϽDz®´Ï´Ù.
//Áּҹٲٰí, ¾ÆÀ̵ð¶û Æнº¿öµå Æ÷½ºÆ®³¯·Á¼ ·Î±×ÀÎÇÑÈÄ¿¡ Ķ¸°´õ url·Î Á¢¼ÓÇؼ
//¸®½ºÆ®±Ü¾î¿À¸éµÇ´Ï²Ê¿¬~~~
OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
out.write(
//µé¾î°¥ ¼Ó¼º°ªµéÀ» Á¤ÇÕ´Ï´Ù.
"&targetUrl="+"¼Ó¼º°ª"
+"&postId="+"±Û¹øÈ£"
+"&commentId="+"ÄÚ¸àÆ®¹øÈ£"
+"&content="+¼öÁ¤ÇÒ´ñ±Û³»¿ë);
//Ç÷¯½¬¸¦ ÇØÁà¾ß º¸³»Áý´Ï´Ù.
out.flush();
InputStream put = con.getInputStream();
out.close();
//¿ä°í´Â Á¦´ë·Î º¸³»Á³³ª È®ÀÎÇÏ´Â °Íµé...
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String decodedString;
while((decodedString = in.readLine())!=null)
{
System.out.print(decodedString);
}
in.close();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)