Java 如何在php中显示http_post?
我在android项目中发送了以下http_post xml:Java 如何在php中显示http_post?,java,php,android,Java,Php,Android,我在android项目中发送了以下http_post xml: try { xml_input(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); Log.e("Hiba!", "Xml_input fgv hivasa"); } //
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发送吗
http\u post
数据。像-
echo $_POST['foo'];
您到底想显示什么?可能的重复项只需在POST参数中传递xml字符串,然后通过以下方式在PHP中显示它:
$xml=$\u POST['yourParameterXML'];echo$xml代码>这就是我不明白的我的参数是什么?因为我不发送任何不是这样的参数:List params=new ArrayList();我明白。。。但是我如何用这个代码发送这个“foo”呢?因为没有这样的行:List params=new ArrayList()@david尝试将内容类型标题设置为“application/x-www-form-urlencoded”。然后发送纯文本以查看是否发送了数据。但是如何在php站点上显示这些数据呢?因为现在我不会像你说的那样发送任何参数,比如“foo”…@david你试过print\r($\u POST)
?