Page 785 - 3-2
P. 785

Toast.LENGTH_LONG).show();
                        }
                        @Override
                        protected String doInBackground(String... params) {


                            try {
                                String id = (String) params[0];


                                String link = "http://192.168.0.77/login.php"; //php  주소
                                String   data    =    URLEncoder.encode("id",     "UTF-8")     +    "="    +
            URLEncoder.encode(id,"UTF-8");


                                URL url = new URL(link);
                                URLConnection conn = url.openConnection();


                                conn.setDoOutput(true);
                                OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());


                                wr.write(data); //php 로 값 전달
                                wr.flush();


                                BufferedReader        reader        =        new         BufferedReader(new
            InputStreamReader(conn.getInputStream()));


                                StringBuilder sb = new StringBuilder();
                                String line = null;


                                // Read Server Response
                                while ((line = reader.readLine()) != null) {
                                    sb.append(line);
                                    break;
                                }


                                Log.d(this.getClass().getName(), "php 에서 온 값: " + sb.toString());
                                p_password = sb.toString(); //php 의 응답 값을 box    에 저장


                                return sb.toString();


                            } catch (Exception e) {
                                Log.d(this.getClass().getName(), "Exception: " + e.getMessage());
                                return new String("Exception: " + e.getMessage());
                            }
                        }
                    }
                    SelectData task = new SelectData();


                                                         - 785 -
   780   781   782   783   784   785   786   787   788   789   790