¾ÛÅøÁî
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 Á¶È¸ : 7122
ÀбâÀü¿¡...
 
¿ì¼± ¼Ò½º¸¦ ¸ÕÀú ¿Ã¸³´Ï´Ù.
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°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
68     °£¸¸¿¡ ±Û¾²³×¿ä À̹ø¿£ launcherShortCut (¹Ù·Î°¡±â ¾ÆÀÌÄÜ)ÀÔ´Ï´Ù. Á¤¿ìÁø 07-24 4872
67  ¸ð¹ÙÀÏ ±¤°í¸¦ ÅëÇؼ­ ¾Û È«º¸ ÀÌ°æ¿ë 06-28 5683
66  Citirne Framework·Î °³¹ßÇÑ ¼îÇθô ¾Û ¼Ò½º °ø°³ÇÕ´Ï´Ù.(Android, iOS) +1 ¾¾Æ®¸°°³¹ß¡¦ 06-13 6234
65  À̹ø¿¡ °³¹ßÇÑ ¼îÇθô¾Û Àüü ¼Ò½ºÀÔ´Ï´Ù. +7 ¾¾Æ®¸°°³¹ß¡¦ 04-26 7161
64     À̹ø¿¡ °³¹ßÇÑ ¼îÇθô¾Û Àüü ¼Ò½ºÀÔ´Ï´Ù. ±è°æö 04-26 4753
63  Bitmap ÆÄÀÏ È¸Àü½ÃÅ°±â ±èÀºÈ£ 04-24 6221
62  BItmap size Resizing ½ÃÄÑÁֱ⠱èÀºÈ£ 04-24 5189
61  Image ÆÄÀÏÀÌ ÀúÀåµÇ´Â ¸®¾ó°æ·Î ¾Ë·ÁÁÖ±â. ±èÀºÈ£ 04-24 5457
60  Bitmap¿¡ Resource ³Ö±â ±èÀºÈ£ 04-24 4826
59  ÆùÀÇ Çϵå¿þ¾î Á¦¾î°ü·Ã ȤÀº Çϵå¿þ¾îÁ¢±Ù°ü·Ã ¾Û Á¦ÀÛ½Ã. ±èº´ÁÖ 02-29 5061
58  ÀÌŬ¸³½º ´ÜÃàÅ° +4 ÇÑÁ¾±Ô 03-29 3718
57  Layout Multiple Touch °£´Ü ±¸Çö. +1 ±èº´ÁÖ 01-20 4862
56  ¾Èµå·ÎÀ̵å Çػ󵵺° ÁÂÇ¥+ À̹ÌÁö Å©±â ¼öÁ¤Çϱâ(º¯Á¾µð½ºÇ÷¹ÀÌ´Â Àû¿ëx) ±èº´ÁÖ 01-18 13142
55  ³¯¾¾¾Û Á¦ÀÛÇϽô ºÐµé Âü°í¿ë. +1 ±èº´ÁÖ 01-06 8482
54  °¶·°½ÃS ¸¶ÄÏ ¿ë·® Á¦ÇÑ 30MB +6 ÀÌ°æ¿ë 12-14 6637
53  ±¸±Û Ä̸°´õ ¿¬µ¿Çϱâ. +6 ±èº´ÁÖ 11-30 7123
52     ±¸±Û Ä̸°´õ ¿¬µ¿Çϱâ + ±Û¾²±â. ±èº´ÁÖ 12-01 5652
51        ¿øº»ÀÌ ¼öÁ¤ÀÌ ¾ÈµÇ´Â°ü°è·Î...(±¸±Û Ķ¸°´õ ¸®½ºÆ®JSON±Ü¾î¿À±â+ µî·Ï) ±èº´ÁÖ 12-03 6680
50  °£´ÜÇÑ À§Á¬ ¸¸µé±â. +1 ±èº´ÁÖ 11-21 8006
49  ¾Æ·¡¿¡ À̾ Ƽ½ºÅ丮 ´ñ±Û ¼öÁ¤Çϱâ.(POSTÆí) +1 ±èº´ÁÖ 11-09 4994
 1  2  3  4  5  
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.