¾ÛÅøÁî
46.¢½.168.138
46.¢½.168.129
46.¢½.168.161
46.¢½.168.136
46.¢½.168.145
46.¢½.168.162
46.¢½.168.144
46.¢½.168.140
115.¢½.135.198
46.¢½.168.139
 
°Ô½Ã¹° 88°Ç
   
±¸±Û Ä̸°´õ ¿¬µ¿Çϱâ.
±Û¾´ÀÌ : ±èº´ÁÖ                   ³¯Â¥ : 2011-11-30 (¼ö) 15:19 Á¶È¸ : 7149
ÀбâÀü¿¡...
 
¿ì¼± ¼Ò½º¸¦ ¸ÕÀú ¿Ã¸³´Ï´Ù.
1.¾ÆÁ÷ µî·Ï ºÎºÐÀ» ó¸®ÇÏÁö ¾Ê¾Ò½À´Ï´Ù.
2.¼Ò½º´Â ¿ÀÁ÷ °¡Àå ÃÖ±ÙÀÇ ÇÑ°³ÀÇ ¸®½ºÆ®¸¸À» °¡Á®¿É´Ï´Ù.
3.¼Ò½º´Â "ÀÚ¹Ù"¸¦ ±âÁØÀ¸·Î ÀÛ¼ºÇÏ¿´½À´Ï´Ù.
4.¾Èµå·ÎÀ̵忡¼­ »ç¿ëÇϽǶ§´Â ¹®¼­¸¦ parsingÇÏ´Â °÷À» xmlpullparsingÀ» ÀÌ¿ëÇÏ¿©
°¡Á®¿À½Ã°í, µî·ÏÀº post¸¦ ÀÌ¿ëÇϽøéµÉµíÇϳ׿ä.
 
<¼Ò½º>
 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import javax.net.ssl.HttpsURLConnection;
 
class test
{
 static ArrayList<String> items;
 static ArrayList<String> items2;
 static String USER_ID;
 static String USER_Pass;
 static String APP_NAME;
 static String getGSID;
 static String Note;
 static String ar=null;
 public static void main(String[] args)
 {
 USER_ID = "¾ÆÀ̵ð";
 USER_Pass = "ºñ¹ø";
 APP_NAME = "¾ÛÀ̸§";
  
  post();
  if(ar!=null)
  {
   listgeting();
  }
  if(ar!=null &&getGSID !=null)
  {
   listadd();
  }
 }
//ÀÏÁ¤À» Ãß°¡Çϴ°̴ϴÙ.
//¿ª½Ã³ª ÀÏ¹Ý OutputÀ¸·Î´Â µ¥ÀÌÅ͸¦ ¸ø¾¹´Ï´Ù.
//XMLÇüÅ·Πº¸³»¾ßµÉµíÇÕ´Ï´Ù.
public static void listadd()
{
try {
//±× pk¼¾ÅÒ¿¡ ÀÖ´Â ³»¿ëÀ¸·Î´Â gssesionsID¸¦ °¡Á®¿Í¾ßµÈ´Ù°í ÇßÁö¸¸. Á¢¼ÓÇÏ¸é ±×³É ¹Þ¾ÆÁý´Ï´Ù.
//µû¶ó¼­ µû·Î ³ÖÀ» ÇÊ¿ä°¡ ¾ø½À´Ï´Ù.
 URL url = new URL("http://www.google.com/calendar/feeds/"+USER_ID+"/private/full");
 HttpURLConnection con = (HttpURLConnection)url.openConnection();
 con.setDoInput(true);
 con.setDoOutput(true);
 con.setRequestMethod("POST");
 con.setRequestProperty("Content-Type", "application/atom+xml");
 con.setRequestProperty("Authorization", "GoogleLogin auth="+ar);
 InputStream put = con.getInputStream();
 BufferedReader br = new BufferedReader(new InputStreamReader(put));
 String decode;
 while((decode =br.readLine())!=null)
 {
  System.out.println(decode);
 }
 br.close();
 
 
} catch (MalformedURLException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
} catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}
}
 
//¸®½ºÆ®¿¡¼­ °¡Àå ÃÖ±ÙÀÇ ¸®½ºÆ®ÀÇ Á¦¸ñÀ» °¡Á®¿É´Ï´Ù.
public static void listgeting()
{
try {
//°¡Á®¿À´Â ¹®¼­ÇüŸ¦ µÎ°¡Áö, XML°ú JsonÇüÅ·Π°¡Á®¿Ã¼öÀִµ¥
//JsonÀ» °¡Á®¿À½Ç¶§´Â OutputStreamWriter¸¦ ÀÌ¿ëÇؼ­ "?alt=json"ÇϽøéµË´Ï´Ù.
//XMLÀº ±×³É ÀÌ·¸°Ô µÎ¸é ±×³É ±âº»À¸·Î XML·Î °¡Á®¿É´Ï´Ù.

 URL url = new URL("http://www.google.com/calendar/feeds/"+USER_ID+"/private/full");
 HttpURLConnection con = (HttpURLConnection)url.openConnection();
 con.setDoOutput(true);
 con.setRequestMethod("GET");
 con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
 con.setRequestProperty("Authorization", "GoogleLogin auth="+ar);
 
 InputStream put = con.getInputStream();
 BufferedReader in = new BufferedReader(new InputStreamReader(put));
 String decodedString;
 
 while((decodedString = in.readLine())!=null)
 {
 if(decodedString.contains("<title type='text'>"))
 {
 int start = decodedString.lastIndexOf("<title type='text'>");
 int end =decodedString.lastIndexOf("</title>");
 Note= decodedString.substring(start+19,end);
 System.out.println(Note);
 }
 }
 
 
 in.close();
 
} catch (MalformedURLException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
} catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}
 
 
}
//·Î±×ÀÎ ¹× ÀÎÁõÅ° ¹ß±Þ ±×¸®°í ¸®½ºÆ®¸¦ °¡Á®¿É´Ï´Ù.
public static void post()
{
 items = new ArrayList<String>();
 try {
//±¸±Û¿¡ ·Î±×ÀÎÀ» ÇÕ´Ï´Ù.

  URL url = new URL("https://www.google.com/accounts/ClientLogin ");
    
  HttpURLConnection con = (HttpURLConnection)url.openConnection();
  con.setDoOutput(true);
  con.setRequestMethod("POST");
 
//ÀԷ¹ÞÀº ¾ÆÀ̵ð¿Í Æнº¿öµå ±×¸®°í ¾ÛÀ̸§À» °¡Áö°í ·Î±×ÀÎÀ» ÇÔ°ú µ¿½Ã¿¡ Ä̸°´õ·Î
//¼­ºñ½º¸¦¹Þ°í, Ãß°¡·Î ÀÎÁõÅ°µµ ¹Þ¾Æ¿É´Ï´Ù. ÀÎÁõÅ°´Â À§ÀÇ ¸Þ¼Òµå¿¡¼­ Ä̸°´õ ¼­ºñ½º¸¦
//ÀÌ¿ëÇϴµ¥ ¹Ýµå½Ã ÇÊ¿äÇÕ´Ï´Ù.
  OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
  out.write(
    +"&Passwd="+USER_Pass
    +"&source="+APP_NAME
    +"&service="+"cl");
  out.flush();
  InputStream put = con.getInputStream();
  out.close();
  BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
  String decodedString;
  while((decodedString = in.readLine())!=null)
  {
//ÀÌÄ£±¸°¡ SID,LSID,Auth¸¦ ¹Þ¾Æ¿É´Ï´Ù. 2¹ø°°¡ AuthÀ̹ǷΠAuthÀ妽º¸¸ »Ì¾Æ¼­
//»ç¿ëÇϵµ·Ï ÇÕ´Ï´Ù.
  items.add(decodedString);
  }
  in.close();
   ar = items.get(2).substring(5);
  System.out.println(ar);
 
  //±¸±Û Ä̸°´õ ¸®½ºÆ®¸¦ ÃëµæÇÕ´Ï´Ù.
  //·Î±×ÀÎÀ» ÀÎÁõÅ°¸¦ ÀÌ¿ëÇؼ­ ÇÕ´Ï´Ù. µû¶ó¼­ À§¿¡¼­ ¹Ýµå½Ã Auth¸¦ ¹ÞÀ¸¼Å¾ßµË´Ï´Ù.
  URL url2 = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full");
  HttpURLConnection conn =(HttpURLConnection)url2.openConnection();
  conn.setDoOutput(true);
  conn.setDoInput(true);
  conn.setRequestMethod("GET");
  conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  conn.setRequestProperty("Authorization", "GoogleLogin auth = "+ar); 
  
  InputStream inner = conn.getInputStream();
  
  items2 = new ArrayList<String>();
  BufferedReader inner2 = new BufferedReader(new InputStreamReader(inner));
  String incodedSring;
  while((incodedSring= inner2.readLine())!=null)
  {
  //¿©±â¼­´Â xml¹®¼­¸¦ ±×³É ½ºÆ®¸µÀ¸·Î ¹Þ¾Æ¼­ ó¸®Çߴµ¥ ¾Èµå·ÎÀ̵忡¼­´Â
 //XMLPullParsingÀ¸·Î ó¸®ÇϽøéµË´Ï´Ù.
   items2.add(incodedSring);
   for(int i =0; i<items2.size(); i++)
   {
   System.out.println(items2.get(i));
   }
  }
  
  inner2.close();
 } catch (MalformedURLException e) {
  // TODO Auto-generated catch block
  System.out.println("1Auth faild or Address Not Redirections");
 } catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  System.out.println("2Auth faild or Address Not Redirections");
 }
 
}
 
 
}
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)




±èº´ÁÖ ´ÔÀÇ Tip&Tech ÃÖ½Å±Û [´õº¸±â]


 
¿î¿µÀÚ 2011-11-30 (¼ö) 15:20
¿ÀÈ£~ ±Â ÆÁ!!!
 
¹Ú°¡¶÷ 2011-12-01 (¸ñ) 13:00
À̹ø Çб⠳¡³ª°í ÇغÁ¾ß°Ú³×¿ä¤Ð Áö±Ý ¼ÒÄÏÇÁ·Î±×·¡¹ÖÀ¸·Î äÆà ±¸ÇöÇÏ´Â ÁßÀε¥ »ç½ÇÀº Ķ¸°´õ ¿¬µ¿µÇ´Â ´ÙÀ̾°¡ ÇÏ°í ½Í¾ú´Ù´Â... ½½Ç Çö½Ç
 
¹Ú°¡¶÷ 2011-12-20 (È­) 12:14
//ÀԷ¹ÞÀº ¾ÆÀ̵ð¿Í Æнº¿öµå ±×¸®°í ¾ÛÀ̸§À» °¡Áö°í ·Î±×ÀÎÀ» ÇÔ°ú µ¿½Ã¿¡ Ä̸°´õ·Î
//¼­ºñ½º¸¦¹Þ°í, Ãß°¡·Î ÀÎÁõÅ°µµ ¹Þ¾Æ¿É´Ï´Ù. ÀÎÁõÅ°´Â À§ÀÇ ¸Þ¼Òµå¿¡¼­ Ä̸°´õ ¼­ºñ½º¸¦
//ÀÌ¿ëÇϴµ¥ ¹Ýµå½Ã ÇÊ¿äÇÕ´Ï´Ù.
  OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
  out.write(
    +"&Passwd="+USER_Pass
    +"&source="+APP_NAME
    +"&service="+"cl");
  out.flush();
  InputStream put = con.getInputStream();
  out.close();
  BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
  String decodedString;
  while((decodedString = in.readLine())!=null)
  {

¿©±â ºÎºÐ¿¡ "&id="+USER_Id°¡ ºüÁø °Í °°°í

BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
¿©±â¿¡¼­ ¿À·ù°¡ ³ª³×¿ä
     
     
 
±èº´ÁÖ 2012-01-03 (È­) 10:11
&id°¡ ¾Æ´Ï°í ¾Æ¸¶
"&Email="+USER_ID ÀÌ·¸°Ô ¾²¼Å¾ß µÉ°Ì´Ï´Ù.
 
¹Ú°¡¶÷ 2011-12-20 (È­) 12:15
java.io.IOException: Server returned HTTP response code: 403 for URL: https://www.google.com/accounts/ClientLogin
2Auth faild or Address Not Redirections
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at test.post(googleCal.java:142)
at test.main(googleCal.java:30)
---------
¿À·ù´Â ÀÌ·¸°Ô ³ª³×¿ä
 
±èº´ÁÖ 2012-01-03 (È­) 10:11
403¿¡·¯´Â ÁÖ¼Ò Çü½Ä ÁöÁ¤ ¿À·ùÀÔ´Ï´Ù.
À§ÀDZۿ¡¼­ "&Email="+USER_IDÀ̺κÐÀ» Ãß°¡Çϼż­ ÇϽøé Á¦´ë·Î µÉ°Ì´Ï´Ù.
   

°Ô½Ã¹° 88°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
88  <Ŭ¶ó¿ìµåÇõ½Å¼¾ÅÍ> 12¿ù 1ÀÏ SW ½ºÅ¸Æ®¾÷ â¾÷ ¼º°ø Àü·« ¼¼¹Ì³ª Âü¼® ¿äû Áظð 11-30 3784
87  <Ŭ¶ó¿ìµåÇõ½Å¼¾ÅÍ> 12¿ù 1ÀÏ SW ½ºÅ¸Æ®¾÷ â¾÷ ¼º°ø Àü·« ¼¼¹Ì³ª Áظð 11-23 3660
86  °³Àΰ³¹ßÀÚ SW°³¹ßȯ°æ Áö¿ø»ç¾÷ ¾È³» Áظð 10-28 3885
85  ¸Æ¿¡¼­ ±¸±Û API key µî·Ï¹æ¹ý ¼º±âµ¿ 08-29 4396
84  [Agate Mobile] ¾Û ¼³Ä¡ ¾øÀÌ ¼­¹ö·ÎºÎÅÍ ½Ç½Ã°£ ·Îµù µÇ¾î µ¿ÀÛÇÏ´Â Cloud Native App ÇÁ·¹ÀÓ¿öÅ©ÀÔ´Ï´Ù. ¾¾Æ®¸°°³¹ß¡¦ 07-21 7415
83     [Agate Mobile] ¾Û ¼³Ä¡ ¾øÀÌ ¼­¹ö·ÎºÎÅÍ ½Ç½Ã°£ ·Îµù µÇ¾î µ¿ÀÛÇÏ´Â Cloud Native App ÇÁ·¹ÀÓ¿öÅ©ÀÔ´Ï´Ù. ±èÀºÈ£ 08-21 11978
82  ÀÚ¹Ù Ãʺ¸µé¿¡°Ô ÃßõÇÏ´Â ±âÃÊ °³³äÀ» ÀâÀ» ¼ö Àִ åµé ÀÌ°æ¿ë 06-19 5691
81  [ÆÁ] °¶·°½Ã ³ëÆ®3 °³¹ßÀÚ ¿É¼Ç ¸Þ´º ã±â ^^ ÀÌ°æ¿ë 11-09 9633
80  ¾ÛÅÛÇø´À» Á¦°øÇÏ´Â »çÀÌÆ® ¼Ò°³ÇÕ´Ï´Ù. ¾¾Æ®¸°°³¹ß¡¦ 08-21 12226
79  The content of the adapter has changed but ListView ... ¿¡·¯ ÀϹÝÀû ÇØ°á¹ý. ±èº´ÁÖ 04-16 15350
78  °£´ÜÇÏ°Ô Æнº¿öµå¿¡ ¼ýÀÚ°¡ È¥¿ëµÇ¾ú´ÂÁö ó¸®ÇÒ ¼ö ÀÖ´Â ¸Þ¼ÒµåÀÔ´Ï´Ù. ±èº´ÁÖ 01-31 6415
77  handler¸¦ ÀÌ¿ëÇØ °¡º¯½Ã°£ ¹Ýº¹ ÀÛ¾÷Çϱâ. ±èº´ÁÖ 11-26 8349
76  String -> HEX ±èº´ÁÖ 11-12 5748
75  ¸®½ºÆ® ÀÛ¾÷½Ã¿¡ ±âº»ÀûÀ¸·Î ¾Ë¾ÆµÎ¼Å¾ß µÉÁ¡. +1 ±èº´ÁÖ 10-08 6819
74  xml Á÷·Äó¸® °í¹ü¼® 09-24 4385
73  ÁÖ¼Ò·Ï Ãß°¡/»èÁ¦ °¨ÁöÇؼ­ ¾ÛÀÇ dbÃß°¡/»èÁ¦Çϱâ. ±èº´ÁÖ 09-24 12438
72  È®À帮½ºÆ®°¡ 3µª½º ÀÌ»óÀÌ µÉ±î? ¾ÈµÉ±î? +1 ±èº´ÁÖ 08-21 7594
71  ZXing ¹ÙÄÚµå ½ºÄµºÎºÐ Å©±â Á¶ÀýÇϱâ. ±èº´ÁÖ 08-06 14626
70  ÀÌŬ¸³½º¿¡¼­ ·¹À̾ƿô xml ±×·¡ÇȺκÐÀÌ °©Àڱ⠾Ⱥ¸ÀÏ°æ¿ì. +1 ±èº´ÁÖ 07-27 6397
69  °£¸¸¿¡ ±Û¾²³×¿ä À̹ø¿£ launcherShortCut (¹Ù·Î°¡±â ¾ÆÀÌÄÜ)ÀÔ´Ï´Ù. ±èº´ÁÖ 07-25 11990
 1  2  3  4  5  
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.