java는post로 json을 발송하고 로그인 정보를 수락합니다

3736 단어 json
java는post로 json을 발송하고 로그인 정보를 수락합니다
  void test()
    {
        //           
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {

                    Map<String, Object> headers = new HashMap<>();

                   //       json headers.put("content-type", "application/json");
                    headers.put("User-Agent", "Dalvik/2.1.0");

                    HashMap<String,String> hm = new HashMap<String,String>();
                    hm.put("Password", "17ffe5be28a1db29b33375354794978d" );
                    hm.put("Phone", "18196646056^android_1.52");
                    hm.put("Signature", "771c74c48b57d57888a37189b52ff42a");

                    Charset cs = Charset.forName("utf-8");
                    String result = Requests.post("http://account.seasidecity.cn/api/Member/Login")
                        //    .headers(headers )
                            .requestCharset(cs)//    
                            .body(hm)//     
                            .send()
                            .withCharset(cs)//    
                            .readToText();
                    Log.i("    ","result-->" + result);

                }catch (Exception e)
                {
                    Log.i("test","ERROR2");
                    PostGetUtil.sendData();
                }
            }
        }).start();
    }

좋은 웹페이지 즐겨찾기