2011-07-04 3 views
0

imgur 웹 사이트에서 xml 파일로 이미지를 가져 오려고합니다. andgroid에서 imgur에서 xml 파일로 이미지 가져 오기

내가 작성한 코드입니다 :

try { 
      HttpClient client = new DefaultHttpClient();   
      String getURL = "http://api.imgur.com/2/account/images.xml";   
      HttpGet get = new HttpGet(getURL);   
      HttpResponse responseGet = client.execute(get);   
      HttpEntity mResEntityGet = responseGet.getEntity();   
      if (mResEntityGet != null) {    
       //do something with the response    
       String content = EntityUtils.toString(mResEntityGet); 
      } 
} catch (ClientProtocolException e) {} 
} catch (IOException e) {} 

문제는 행이다 "HttpResponse에 responseGet = client.execute는 (GET);" IO 예외를 throw합니다.

나는 탐색기에서 URL이 다음 나에게 다음과 같은 XML을 제공 작성하는 경우 :

<?xml version="1.0" encoding="utf-8" ?> 
- <error> 
    <message>This method requires authentication</message> 
    <request>/2/account/images.xml</request> 
    <method>get</method> 
    <format>xml</format> 
    <parameters /> 
    </error> 

나는 imgur 웹 사이트에서 이미지 xml 파일을 얻을 수있는 방법 어떤 생각?

답변