andriod履行http的post办法itjob - AG环亚娱乐

andriod履行http的post办法itjob

2019-02-11 08:58:24 | 作者: 振荣 | 标签: | 浏览: 4240

HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("https://www.yoursite.com/script.php"); try { // 增加你自己的参数 List NameValuePair nameValuePairs = new ArrayList NameValuePair nameValuePairs.add(new BasicNameValuePair("id", "12345")); nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // 履行 HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block }

 

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表AG环亚娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章