php Php在post请求中读取xml
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2068875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Php reading xml in post request
提问by Kapil D
So, I have perform two steps
所以,我已经执行了两个步骤
a) Create a some random xml file in one of the php file. b) Parse the same xml file in second file.
a) 在其中一个 php 文件中创建一些随机的 xml 文件。b) 在第二个文件中解析相同的 xml 文件。
Key points are that php file in a) will issue a post request to php file b) with only xml as its request.
关键点是 a) 中的 php 文件将向 php 文件 b) 发出一个 post 请求,只有 xml 作为它的请求。
file b) will have to read the xml file using SImpleXml.
文件 b) 必须使用 SImpleXml 读取 xml 文件。
I am trying to do something for this http://blog.superfeedr.com/API/pubsubhubbub/getting-started-with-pubsubhubbub/.
我正在尝试为此http://blog.superfeedr.com/API/pubsubhubbub/getting-started-with-pubsubhubbub/做点什么。
I my server will be receiving notifications in form of xml from the the superfeeder. The notifications will be xml file in the request.
我的服务器将从超级馈送器接收 xml 形式的通知。通知将是请求中的 xml 文件。
I am doing step a) just to confirm that my part b) is correct.
我正在执行步骤 a) 只是为了确认我的部分 b) 是正确的。
How to do this in PHP. I tried all the $_REQUEST, $GLOBALS variable. But, not sure whats the way!
如何在 PHP 中执行此操作。我尝试了所有 $_REQUEST、$GLOBALS 变量。但是,不确定是什么方式!
回答by Chris Gutierrez
I'm not really sure I understand what you are trying to do but try looking in to reading raw post data. Here is a blog post that talks about it a little bit.
我不确定我是否理解您要尝试做的事情,但请尝试查看原始帖子数据。这是一篇关于它的博客文章。
回答by Christian Davén
If you want to send POST data from PHP, you could use cURL. You can't set $_POSTor $_REQUESTat the sending side and expect them to be set at the receiving end as well.
如果你想从 PHP 发送 POST 数据,你可以使用 cURL。您不能在发送端设置$_POST或$_REQUEST并期望它们也设置在接收端。
Have a look at this question: Send XML over HTTPS/POST via cURL?

