如果您想在服务器上发布数据,那么您需要为发布数据精心设计服务器。最近我的服务器配置我使用此代码发布数据并且执行良好。
Button send = (Button) findViewById(R.id.send_sms);        
    send.setOnClickListener(this);
public void onClick(View v) 
 {
       switch (v.getId()) 
       {
       case R.id.send_sms:
               try {
                    HttpClient client = new DefaultHttpClient();  
                    String postURL = "http://10.0.2.2/folder/saver.php";
                    HttpPost post = new HttpPost(postURL); 
                        List<NameValuePair> params = new ArrayList<NameValuePair>();
                        params.add(new BasicNameValuePair("cell", "+8801899999"));
                        params.add(new BasicNameValuePair("pin", "1234"));
                        params.add(new BasicNameValuePair("msg", "hi!"));
                        UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params,HTTP.UTF_8);
                        post.setEntity(ent);
                        HttpResponse responsePOST = client.execute(post);  
                        HttpEntity resEntity = responsePOST.getEntity();  
                        if (resEntity != null) {
                            showAlert(EntityUtils.toString(resEntity));
                            //Log.i("RESPONSE",EntityUtils.toString(resEntity));
                        }
                } catch (Exception e) {
                    e.printStackTrace();
                }
           break;
       }
 }