java - PHP中post方法读取数据

标签 java php android

我向 PHP 服务器请求如下代码 fragment

StringEntity stringEntity = new StringEntity(myString, "UTF-8"); 
httppost.setEntity(stringEntity);
httppost.addHeader("Accept", "application/xml");
httppost.addHeader("Content-Type", "application/xml");

现在我想将 xml 数据读入 PHP 服务器。

我怎样才能读到它?

最佳答案

$xmlstr= file_get_contents('php://input');
$xml = new SimpleXMLElement($xmlstr);
var_dump($xml )

关于java - PHP中post方法读取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7189712/

相关文章:

java - Maven 在与 "classifier"标记一起使用时生成两个 jar 文件

php - 带有 PHP 的 MySQL - LIKE 无法正常工作

php - 使用 jquery 将 jquery 数组更新为隐藏字段

php - 简单地找到服务器的IP地址

android - StartActivityForResult() 和 OnActivityResult() 都需要吗?

java - 在 Android 上使用 AES 加密文件

java.lang.ExceptionInInitializerError | java.lang.ExceptionInInitializerError | java.lang.ExceptionInInitializerError由 : com. b.a.c.b 引起: 'com.b.a.b.a' 需要 'sequence' 属性

java - 在 Haskell 的类型 A 的函数中从另一个类型 B 返回一些东西

Java抽象使用instanceof从List中收集类

android - 无法在 Intellij 中调试 android 应用程序 : "Warning: debug info can be unavailable."