将android连接到php时有时参数未发送。
user=i.getExtras().getString("user");
params.add(new BasicNameValuePair("user",user));
// getting JSON string from URL
json = jParser.makeHttpRequest(url_orders, "GET", params);
基于空用户获得的结果。
答案 0 :(得分:0)
这对我有用,试试这个:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://URL.com.php");
postParameters.add(new BasicNameValuePair("param1", value1));
postParameters.add(new BasicNameValuePair("param2", value2));
httppost.setEntity(new UrlEncodedFormEntity(postParameters));
HttpResponse response = httpclient.execute(httppost);
String str = inputStreamToString(response.getEntity().getContent())
.toString()