zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

Android通过HttpClient执行post请求详解编程语言

Android执行编程语言 详解 通过 请求 post httpclient
2023-06-13 09:20:29 时间
// Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.yoursite.com/script.php"); try { // Add your data 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)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block }

10681.html

cjavaphp