2013-03-12 4 views
2

하나의 문제가 있습니다. Android 기기 및 일부 사이트에 애플리케이션이 있습니다. POST에서 버튼 확인 처리가 이루어 지므로 올바른 데이터로이 사이트에 POST 요청을 보내고 수 있습니다. 서버 측에서이 POST 검사를 통과하면 내 앱이나 서버 측 코드로 무엇을 할 수 있습니까?Android : 웹 사이트의 버튼을 클릭하십시오.

//go to the ThirdScreen 
Intent intent = new Intent(SecondScreen.this, ThirdScreen.class); 
intent.putExtra("CLIENT_ID", stringClientID); 
intent.putExtra("PASSWORD", getUserPWD); 
intent.putExtra("LANGUAGE", language); 
startActivity(intent); 
finish(); 

Intent intent = getIntent(); 
CLIENT_ID = intent.getExtras().getString("CLIENT_ID"); 

UPD2 어쩌면 내가 가진 : 내가 데이터를 전송하고 이전 작업에서 데이터를 얼마나 여기 가

/****** SEND POST REQUEST ******/ 
private void sendPostRequest_cabinet(String clientID) 
{ 
    class SendPostReqAsyncTask extends AsyncTask<String, Void, String> 
    { 

     @Override 
     protected String doInBackground(String... params) 
     { 

      // insert data into massive 
      String paramClientID = params[0]; 

      HttpClient httpClient = new DefaultHttpClient(); 
      //httpPost = new HttpPost(post_url + /*language from dropdown + */ "/en/login/"); 


      if (LANGUAGE != null) 
      {   
       if (LANGUAGE.equals("English")) 
       { 
        httpPost = new HttpPost(link.getEng()); 
        Toast.makeText(getApplicationContext(), (CharSequence) httpPost, Toast.LENGTH_LONG).show(); 
       } 
       else if (LANGUAGE.equals("Russian")) 
       { 
        httpPost = new HttpPost(link.getRussian()); 
       } 
       else if (LANGUAGE.equals("Dutch(German)")) 
       { 
        httpPost = new HttpPost(link.getDeutch()); 
       } 
       else if (LANGUAGE.equals("French")) 
       { 
        httpPost = new HttpPost(link.getFrance()); 
       } 
       else if (LANGUAGE.equals("Italian")) 
       { 
        httpPost = new HttpPost(link.getItalian()); 
       } 
       else if (LANGUAGE.equals("Spanish")) 
       { 
        httpPost = new HttpPost(link.getSpanish()); 
       } 
      } 

      // send parameters with values 
      BasicNameValuePair email1BasicNameValuePair = new BasicNameValuePair("client_id", paramClientID); 

      // insert parameters into massive 
      List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>(); 
      nameValuePairList.add(email1BasicNameValuePair); 

      try 
      { 
       UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(nameValuePairList); 
       httpPost.setEntity(urlEncodedFormEntity); 

       try 
       { 
        HttpResponse httpResponse = httpClient.execute(httpPost); 
        InputStream inputStream = httpResponse.getEntity().getContent(); 
        InputStreamReader inputStreamReader = new InputStreamReader(inputStream); 
        BufferedReader buffereReader = new BufferedReader(inputStreamReader); 
        StringBuilder stringBuilder = new StringBuilder(); 

        String bufferedStrChunk = null; 

        while ((bufferedStrChunk = buffereReader.readLine()) != null) 
        { 
         stringBuilder.append(bufferedStrChunk); 
        } 

        return stringBuilder.toString(); 
       } 
       catch (ClientProtocolException cpe) 
       { 
        System.out.println("First Exception of HttpResponse: " + cpe); 
        cpe.printStackTrace(); 
       } 
       catch (IOException ioe) 
       { 
        System.out.println("Second Exception of HttpResponse: " + ioe); 
        ioe.printStackTrace(); 
       } 
      } 
      catch (UnsupportedEncodingException uee) 
      { 
       System.out.println("An Exception given because of UrlEncodedFormEntity argument : " + uee); 
       uee.printStackTrace(); 
      } 

      return null; 
     } 

     @Override 
     protected void onPostExecute(String result) 
     { 
      // Toast.makeText(getApplicationContext(), 
      // "POST request has been send successfully", 
      // Toast.LENGTH_LONG).show(); 

      super.onPostExecute(result); 

      //Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); 

      //go to the browser with lang redirect    
      if (LANGUAGE != null) 
      {   
       if (LANGUAGE.equals("English")) 
       { 
        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setData(Uri.parse(link.getEng())); 
        startActivity(i); 
       } 
       else if (LANGUAGE.equals("Russian")) 
       { 
        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setData(Uri.parse(link.getRussian())); 
        startActivity(i); 
       } 
       else if (LANGUAGE.equals("Dutch(German)")) 
       { 
        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setData(Uri.parse(link.getDeutch())); 
        startActivity(i); 
       } 
       else if (LANGUAGE.equals("French")) 
       { 
        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setData(Uri.parse(link.getFrance())); 
        startActivity(i); 
       } 
       else if (LANGUAGE.equals("Italian")) 
       { 
        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setData(Uri.parse(link.getItalian())); 
        startActivity(i); 
       } 
       else if (LANGUAGE.equals("Spanish")) 
       { 
        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setData(Uri.parse(link.getSpanish())); 
        startActivity(i); 
       } 
      } 
     } 
    } 
    /***** second check of Internet connection *****/ 
    if (!isOnline()) 
    { 
     showNoConnectionDialog(this); 
     // Toast.makeText(getApplicationContext(), 
     // "Internet connection is disabled!", Toast.LENGTH_LONG).show(); 
    } 
    else 
    { 
     SendPostReqAsyncTask sendPostReqAsyncTask = new SendPostReqAsyncTask(); 
     sendPostReqAsyncTask.execute(clientID); 
    } 
} 

UPD : 여기

내가 보낼 곳 POST 내 코드입니다 내가 무엇을 필요로하는지 명확하게 설명하지 않았기 때문에 나는 설명하려고 노력할 것이다. 나는이 사이트에 POST를 통해 데이터를 보낼 필요가있다. 내 안드로이드 애플 리케이션을 시작하고, 일부 텍스트 상자에 데이터를 입력하고,이 버튼을 클릭하여 버튼을 클릭 하여이 웹 사이트를 열고 데이터를 보낼 필요가 ...

답변

0

나는 새로운 활동을 작성하여 내 문제를 결정했다 WebView 구성 요소가 포함되어 있고 필요한 사이트를 검색하므로 진행자가이 질문을 닫을 수 있습니다.

관련 문제