简体   繁体   English

Php在post请求中读取xml

[英]Php reading xml in post request

So, I have perform two steps 所以,我执行了两个步骤

a) Create a some random xml file in one of the php file. a)在其中一个php文件中创建一个随机的xml文件。 b) Parse the same xml file in second file. 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. 我的服务器将从超级馈送器接收xml形式的通知。 The notifications will be xml file in the request. 通知将是请求中的xml文件。

I am doing step a) just to confirm that my part b) is correct. 我正在做步骤a)只是为了确认我的b)部分是正确的。

How to do this in PHP. 如何在PHP中执行此操作。 I tried all the $_REQUEST, $GLOBALS variable. 我尝试了所有$ _REQUEST,$ GLOBALS变量。 But, not sure whats the way! 但是,不确定最新的方式!

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. 这是一篇博文,对此进行了一些讨论。

http://www.codediesel.com/php/reading-raw-post-data-in-php/ http://www.codediesel.com/php/reading-raw-post-data-in-php/

If you want to send POST data from PHP, you could use cURL. 如果要从PHP发送POST数据,可以使用cURL。 You can't set $_POST or $_REQUEST at the sending side and expect them to be set at the receiving end as well. 你不能在发送端设置$_POST$_REQUEST ,并期望它们也在接收端设置。

Have a look at this question: Send XML over HTTPS/POST via cURL? 看看这个问题: 通过cURL通过HTTPS / POST发送XML?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM