問題描述
我在 symfony2 應用程序中使用內置的 SOAP-Server,除了處理 StdClass-Object,我還需要讀取收到的完整 xml 以進行調試和記錄.有沒有辦法簡單地捕獲傳輸的xml?它應該在請求頭的某個地方,但我根本找不到它.
I'm using the build-in SOAP-Server within a symfony2 application and beside handling the StdClass-Object, I would need to read the complete xml received for debugging and logging. Is there a way to simply catch the transferred xml? It should be somewhere in the request header, but I simply can't find it there.
推薦答案
我一直在尋找同樣的東西,終于找到了.希望這對您或其他人有所幫助.
I was looking for the same thing and finally found it. Hope this helps you or someone else.
$postdata = file_get_contents("php://input");
$postdata
變量將包含原始 XML.通過以下兩個鏈接找到:
The $postdata
variable will have the raw XML. Found through the following two links:
http://php.net/manual/en/reserved.variables.httprawpostdata.php
http://php.net/manual/en/soapserver.soapserver.php
這篇關于從 PHP SOAP 服務器獲取接收到的 XML的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!