开发者

HTTP_RAW_POST_DATA empty - alternate solution

I'm trying to use a script that is provided by an E-commerce site that obtains data from an XML feed that is posted to a URL on my site. The script gathers the data using....

$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)

The problem开发者_开发技巧 is that there's no data being passed. I understand this is depreciated, but how else would I accomplish this?


$HTTP_RAW_POST_DATA requires an ini value to be set, using the input stream should work without any special ini settings and is also the 'prefered' method. It is worth noting that neither php://input or $HTTP_RAW_POST_DATA is available with enctype="multipart/form-data".

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

Documentation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜