1

This my android code I used to send to my php file in website. also modified android manifest file.

        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(7);
        nameValuePairs.add(new BasicNameValuePair("number", "5556"));
        nameValuePairs.add(new BasicNameValuePair("password",password));
        nameValuePairs.add(new BasicNameValuePair("token",token));

        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://futuretime.in/post.php");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);

This is my php script for receiving data from android. But my problem is when I printed data in php it is not showing any value.

        <?php 
          $number= $_POST['number'];
          $password = $_POST['password'];
          $token   = $_POST['token'];
          echo $number;
        ?>
Zusee Weekin
  • 1,348
  • 2
  • 18
  • 41
user3481084
  • 41
  • 1
  • 3
  • 6

1 Answers1

1

you can try use Ion https://github.com/koush/ion ,is a great library for make http request. is a simple example .check the project site for more examples and wiki.

    Ion.with(getContext(), "https://koush.clockworkmod.com/test/echo")
   .setBodyParameter("goop", "noop")
   .setBodyParameter("foo", "bar")
   .asString()
   .setCallback(...)
ingyesid
  • 2,864
  • 2
  • 23
  • 21