0

将 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);

基于空用户获得的结果。

4

1 回答 1

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()
于 2013-06-28T09:14:17.800 回答