如何将数据从活动发送到php并从同一个php检索数据到另一个活动?

From the first image In my two of the activities I am sending request to php two different php files and I am getting valid response to android activities.

Image 1

In the second image , On combining the above both php files into one php file , when sending request from Activity 1 to php, I am not able to getting response and for activity 2 also.

Image 2

 private void login(final String textViewNameq, String textViewNameqw,String day) {

    class LoginAsync extends AsyncTask<String, Void, String> {

        private Dialog loadingDialog;

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            loadingDialog = ProgressDialog.show(MainActivity.this, "Please wait", "Loading...");
        }

        @Override
        protected String doInBackground(String... params) {
            String uname = params[0];
            String pass = params[1];
            String day=params[2];

            InputStream is = null;
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
            nameValuePairs.add(new BasicNameValuePair("username", uname));
            nameValuePairs.add(new BasicNameValuePair("password", pass));
            nameValuePairs.add(new BasicNameValuePair("day", day));
            String result = null;

            try {
                HttpClient httpClient = new DefaultHttpClient();
                HttpPost httpPost = new HttpPost(
                        "Your php link goes here");
                httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                HttpResponse response = httpClient.execute(httpPost);

                HttpEntity entity = response.getEntity();

                is = entity.getContent();

                BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 8);
                StringBuilder sb = new StringBuilder();

                String line = null;
                while ((line = reader.readLine()) != null) {
                    sb.append(line + "
");
                }
                result = sb.toString();
            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return result;
        }

and My php code goes here,

   <?php
include("my php file path");                        
//  if (!empty($_POST['username']) && !empty($_POST['password'])){
        $Fromname = trim($_POST['username']);
        $Toname = trim($_POST['password']);
        //$Fromdate=$_POST['iddate'];
        //$Fromd = date("Y-m-d", strtotime($Fromdate));
        $from_id=trim($_POST['idss']);
        $to_id=trim($_POST['iddd']);
    //  }

     $url="http://my url with API key goes here";


     $headers = array('Content-Type: application/json');                
            $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_POST, true);   
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);                 
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
                curl_setopt($ch, CURLOPT_ENCODING , "gzip");
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);                        
                $page = curl_exec($ch);
                curl_close($ch);    
                $result=json_decode($page,true);     
                if(empty($result)){                 
                    $page=file_get_contents($url);
                    $result=json_decode($page,true);
                }

It is possible to get the required response from the same php file. All you need to do is send the required information in your request method and process accordingly in the php file and generate the response. We can help help u better if u show ur Php Script