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;
?>
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(...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.