안녕하세요~
현재 안드이드에서 웹서버 통신을 이용한 로그인 처리중에
도저히 안풀리는 문제가 있어서 질문드립니다.
환경셋팅은 apmsetup을 사용해서 했구요
httppost 를 사용해 웹서버의 php 소스로 인자를 날려 처리후 결과값을 받도록 소스를 짰어요.
근데 어제까지만해도 결과값 리턴이 잘됐었는데 어느순간 갑자기 엉뚱한 값을 반환하더라구요.
간단한 스트링 결과를 리턴해야되는데 html 문서 전체가 딸려와서 조금 당황스럽네요;;
웹서버 ip의 main html 태그가 다 딸려옵니다...
db에 회원등록은 되는거 보니까 통신문제는 아닌것 같은데.. 어떻게 해봐도 해결이 안되네요 ㅠㅠ
아래는 해당 소스구요.. 조언좀 해주시면 감사하겠습니다!
private void login() {
// TODO Auto-generated method stub
try{
httpclient = new DefaultHttpClient();
httppost= new HttpPost("http://웹서버ip/project/login.php");
nameValuePairs = new ArrayList<NameValuePair>(2);
try {
myPWord = SimpleCrypto.encrypt(CRYPTO_SEED_PASSWORD, edtPass.getText().toString().trim());
} catch (Exception e) {
// TODO Auto-generated catch block
}
nameValuePairs.add(new BasicNameValuePair("id",edtId.getText().toString().trim()));
nameValuePairs.add(new BasicNameValuePair("password", myPWord));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "euc-kr"));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String result = httpclient.execute(httppost, responseHandler);
System.out.println("Result : " + result);
runOnUiThread(new Runnable()
{
public void run() {
dialog.dismiss();
}
});
if(result.equalsIgnoreCase("User Found"))
{
runOnUiThread(new Runnable()
{
public void run()
{
Toast.makeText(Login.this,"Login Success", Toast.LENGTH_SHORT).show();
}
});
finish();
startActivity(new Intent(Login.this, Main.class));
}
else
{
showAlert();
}
}catch(Exception e)
{
dialog.dismiss();
System.out.println("Exception : " + e.getMessage());
}
}