PHP在post请求中读取xml
因此,我执行了两个步骤
a) 在其中一个 php 文件中创建一些随机 xml 文件。 b) 解析第二个文件中的相同 xml 文件。
关键点是 a) 中的 php 文件将向 php 文件 b) 发出仅 xml 作为请求的 post 请求。
文件 b) 必须使用 SImpleXml 读取 xml 文件。
我正在尝试为此做一些事情 http://blog.superfeedr .com/API/pubsubhubbub/getting-started-with-pubsubhubbub/。
我的服务器将从 superfeeder 接收 xml 形式的通知。通知将是请求中的 xml 文件。
我正在执行步骤 a) 只是为了确认我的 b) 部分是正确的。
如何在 PHP 中执行此操作。 我尝试了所有 $_REQUEST、$GLOBALS 变量。但是,不知道该怎么办!
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.
Key points are that
php file in a) will issue a post request to php file b) with only xml as its request.
file b) will have to read the xml file using SImpleXml.
I am trying to do something for this 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.
I am doing step a) just to confirm that my part b) is correct.
How to do this in PHP.
I tried all the $_REQUEST, $GLOBALS variable. But, not sure whats the way!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太确定我理解你想要做什么,但尝试阅读原始帖子数据。这是一篇博客文章,对此进行了一些讨论。
http://www.codediesel.com/php/reading- raw-post-data-in-php/
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/
如果你想从 PHP 发送 POST 数据,你可以使用 cURL。您不能在发送端设置
$_POST
或$_REQUEST
并期望它们也在接收端设置。看看这个问题:通过 cURL 通过 HTTPS/POST 发送 XML?
If you want to send POST data from PHP, you could use cURL. You can't set
$_POST
or$_REQUEST
at the sending side and expect them to be set at the receiving end as well.Have a look at this question: Send XML over HTTPS/POST via cURL?