Qas*_*sim 4 java httpresponse httpclient http-post
这是我的HttpClient请求:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.***.**/***/***_***.php");
String HTML = "";
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("from", contactName));
nameValuePairs.add(new BasicNameValuePair("msg", message));
nameValuePairs.add(new BasicNameValuePair("sent", time_sent));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HTML = "How?";
} catch (ClientProtocolException e) {} catch (IOException e) {}
Run Code Online (Sandbox Code Playgroud)
如何使用请求的源代码填充HTML字符串?
HttpResponse response = httpclient.execute(httppost);
HTML = EntityUtils.toString(response.getEntity());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6793 次 |
| 最近记录: |