2013-03-11 23 views
-1

我有了这个HTTP_POST XML在我的Android项目发送:如何在php中显示http_post?

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发送,如果我想要一些规则等发送到服务器?
+0

你想要显示什么? – eis 2013-03-11 15:07:15

+0

可能重复的[PHP发布请求中的XML读取](http://stackoverflow.com/questions/2068875/php-reading-xml-in-post-request) – Quentin 2013-03-11 15:07:21

+0

我发送的xml文件 – david 2013-03-11 15:08:00

回答

1

你可以在php中使用$_POST超全局关联数组访问数据。 Like-

echo $_POST['foo']; 
+0

我明白......但我该如何发送这个'foo'这个代码?因为没有这样的行:List params = new ArrayList (); – david 2013-03-11 15:12:20

+0

@david尝试将内容类型标题设置为“application/x-www-form-urlencoded”。并发送纯文本以查看数据是否被发送。 – ShuklaSannidhya 2013-03-11 15:24:13

+0

数据已发送 – david 2013-03-11 15:25:34