有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在php中显示http_post?

我在安卓项目中发送了以下http_post xml:

try {
            xml_input();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Log.e("Hiba!", "Xml_input fgv hivasa");
        }

        // TODO Auto-generated method stub
        HttpPost httppost = new HttpPost("http://users.atw.hu/festivale/xml_post.php");
        StringEntity se;
        try {
            se = new StringEntity(globalconstants.xml_out, HTTP.UTF_8);
            se.setContentType("text/xml");
            httppost.setHeader("Content-Type",
                    "application/soap+xml;charset=UTF-8");
            httppost.setEntity(se);

            HttpClient httpclient = new DefaultHttpClient();
            BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient
                    .execute(httppost);

            HttpEntity r_entity = httpResponse.getEntity();
            String xmlString = EntityUtils.toString(r_entity);

            System.err.println("Error...." + xmlString);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
  • 如何在我的php网站上显示这个
  • 如果我想要一些规则等发送到服务器,这是一个好的xml发送吗

共 (1) 个答案

  1. # 1 楼答案

    可以使用php中的$_POST超全局关联数组访问http_post数据。比如——

    echo $_POST['foo'];