阅读PHP POST方法数据 [英] Read data of post method in PHP
本文介绍了阅读PHP POST方法数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我请求PHP服务器,如下code段
StringEntity stringEntity =新StringEntity(MyString的,UTF-8);
httppost.setEntity(stringEntity);
httppost.addHeader(接受,应用程序/ XML);
httppost.addHeader(内容类型,应用程序/ XML);
现在我想读取XML数据到PHP服务器。
我怎么能读呢?
解决方案
$ xmlstr =的file_get_contents('PHP://输入');
$ XML =新的SimpleXMLElement($ xmlstr);
后续代码var_dump($ XML)
I am requesting to PHP server as below code snippet
StringEntity stringEntity = new StringEntity(myString, "UTF-8");
httppost.setEntity(stringEntity);
httppost.addHeader("Accept", "application/xml");
httppost.addHeader("Content-Type", "application/xml");
Now I want to read that xml data into PHP server.
How can I read that?
解决方案
$xmlstr= file_get_contents('php://input');
$xml = new SimpleXMLElement($xmlstr);
var_dump($xml )
这篇关于阅读PHP POST方法数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文