what are the alternatives for php://input and $HTTP_RAW_POST_DATA when file_get_contents and always_populate_raw_post_data are disabled

 ̄綄美尐妖づ 提交于 2019-11-27 07:13:36

问题


My hosting comp has disabled all the socket functionality except curl. They are so irresponsible on my questions for enabling it. i can think of another hosting yet i want to know the following.

I have asked a question related to this and this is a continuation yet another question.

I am unable to use file_get_contents('php://input') and always_populate_raw_post_data is disabled in php.ini so i cannot use $HTTP_RAW_POST_DATA.

So what is or are the alternatives to get a raw post data.

For example i have setup notifications callback url with facebook. so when ever there is an event then facebook will post information to my site's specific url.

so i need to read the raw post data from facebook and according to the above description i want to know the alternatives for php://input and $HTTP_RAW_POST_DATA.

is it possible to read total content when some body posts to my site including the header so that i can strip off the header part and can use the body of the post?

yeah... we can get the complete contents when some body posts any content.


回答1:


When file_get_contents() is disabled you can use the great functionality of PEAR::PHP_Compat. It consists of an replacement for file_get_contents().

Simply download the latest package, extract it and use it like this:

require_once '/path/to/PHP_Compat-1.6.0a3/Compat/Function/file_get_contents.php';

$content = php_compat_file_get_contents('http://example.com');


来源:https://stackoverflow.com/questions/9907896/what-are-the-alternatives-for-php-input-and-http-raw-post-data-when-file-get

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!