2014-02-05 2 views
0

인증을 필요로하는 일부 사이트의 모바일 버전으로 앱을 만들려고합니다.타사 응용 프로그램의 HttpPost [Android]

public String postData() { 
    HttpClient httpclient = new DefaultHttpClient(); 
    HttpPost httppost = new HttpPost(url + "loginAuth.php"); 
    try { 
     List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); 
     nameValuePairs.add(new BasicNameValuePair("username", username)); 
     nameValuePairs.add(new BasicNameValuePair("password", password)); 
     httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); 

     HttpResponse response = httpclient.execute(httppost); 
     HttpEntity entity = response.getEntity(); 
     if (entity != null) { 
      String responseBody = EntityUtils.toString(entity); 
      return responseBody; 
     } else { 
      return null; 
     } 

    } catch (ClientProtocolException e) { 
     e.printStackTrace(); 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } 
    return null; 
} 

문제는 내가 권한을 부여 할 수없고 postData() 방법은 다시 나에게 인증 페이지를 반환한다는 것입니다 : 여기

<form method="post" 
    action="loginAuth.php" 
    autocomplete="off"> 
    <input id="username" 
     name="username" 
     type="text" 
     class="inp" /> 
    <input id="password" 
     name="password" 
     type="password" 
     class="inp" /> 
    <input type="submit" 
     class="q-button" 
     name="LogIn" 
     value=" Log In"/> 
</form> 

그리고 여기 내 코드 사이트의 로그인 폼이다.

+0

그리고 무엇이 문제입니까? – Budius

+0

Budius, 문제는 내가 인증 할 수없고 postData() 메소드가 승인 페이지를 다시 반환한다는 것입니다. 내가 승인하고 싶지만, – guny

+0

요점은 다음과 같습니다. 앱이 클라우드에서 물건에 액세스하는 올바른 방법은 공개 API를 통해 자신의 응용 프로그램 KEY를 사용하는 것입니다. 당신이 달성하고자하는 것은 해킹 된 해결 방법이며 해킹 가능한 해결 방법으로 할 수있는 일이 너무 많습니다. – Budius

답변

0

이 웹 사이트는 SSL을 사용하지 않으며 해당 인증서 없이도 SSL을 요청할 수 없는지 확인해야합니다.

+0

고맙습니다. 인증서없이 요청을하는 또 다른 방법이 있습니까? – guny

+0

좋습니다. 좋아요. –

관련 문제