2009-12-15 50 views
2

我正尝试使用由电子商务网站提供的脚本,该脚本从发布到我网站上的URL的xml源中获取数据。脚本收集数据使用....HTTP_RAW_POST_DATA空 - 备用解决方案?

$requestBodyXML = new DOMDocument(); 

# Load the request body into XML and check that the result has been parsed into XML  
if ($requestBodyXML->loadXML($HTTP_RAW_POST_DATA) == true) 

问题是,没有数据被传递。我知道这是贬值,但我会怎么做到这一点?

回答

16

$HTTP_RAW_POST_DATArequires an ini value to be set,使用输入流应该没有任何特殊的ini设置,也是'优先'的方法。值得注意的是,对于enctype =“multipart/form-data”,php://input$HTTP_RAW_POST_DATA都不可用。

//The alternative method 
$postData = file_get_contents('php://input') 

Documentation