안드로이드 개발 질문/답변
(글 수 45,052)
public class AndroidLogin extends Activity implements OnClickListener { Button ok,back,exit; TextView result; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Login button clicked ok = (Button)findViewById(R.id.btn_login); ok.setOnClickListener(this); result = (TextView)findViewById(R.id.lbl_result); } public void postLoginData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); /* login.php returns true if username and password is equal to saranga */ try { // Add user name and password EditText uname = (EditText)findViewById(R.id.txt_username); String username = uname.getText().toString(); EditText pword = (EditText)findViewById(R.id.txt_password); String password = pword.getText().toString(); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("username", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request Log.w("SENCIDE", "Execute HTTP Post Request"); HttpResponse response = httpclient.execute(httppost); String str = inputStreamToString(response.getEntity().getContent()).toString(); Log.w("SENCIDE", str); if(str.toString().equalsIgnoreCase("true")) { Log.w("SENCIDE", "TRUE"); result.setText("Login successful"); }else { Log.w("SENCIDE", "FALSE"); result.setText(str); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private StringBuilder inputStreamToString(InputStream is) { String line = ""; StringBuilder total = new StringBuilder(); // Wrap a BufferedReader around the InputStream BufferedReader rd = new BufferedReader(new InputStreamReader(is)); // Read response until the end try { while ((line = rd.readLine()) != null) { total.append(line); } } catch (IOException e) { e.printStackTrace(); } // Return full string return total; } @Override public void onClick(View view) { if(view == ok){ postLoginData(); } } } 현재 여기서 url(http://www.sencide.com/blog/login.php)을보시면 로그인이 잘되는데, https://cityfood.co.kr:40000/happy_member_login.php?mode=login_reg <<이 주소에 적용을 해서 로그인 페이지를 만들고 싶은데 잘안됩니다.... List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("member_id", username));
nameValuePairs
.add(new BasicNameValuePair("memeber_pass", password));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
리스트값은 이렇게 지정을 해주었고, if문안에 뭐가 들어가야 결과값을 출력을 할수 있고, 웹뷰로도 확인이 가능한지 도움 부탁 드립니다.. 앱에서 저 주소로는 로그인을 할수 없는건가요? 아니면 어떻게 해야하나요 ㅠㅠ 몇일동안 앱에서 저 php주소로 로그인을 하는걸로 진도가 안나가네요 ㅠㅠ도와주세요. 



https 프로토콜이라서 그런가보네요.
보안프로토콜로써 추가적인 작업을 해줘야합니다.
httpclient 와 ssl 관련해서 찾아보세요~