当file_get_contents和always_populate_raw_post_data被禁用时,php:// input和$ HTTP_RAW_POST_DATA的替代方法是什么 [英] what are the alternatives for php://input and $HTTP_RAW_POST_DATA when file_get_contents and always_populate_raw_post_data are disabled

查看:286
本文介绍了当file_get_contents和always_populate_raw_post_data被禁用时,php:// input和$ HTTP_RAW_POST_DATA的替代方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的托管组件已禁用除curl之外的所有套接字功能。他们在启用它的问题上是如此不负责任。我可以想到另一个主机但我想知道以下内容。

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.

我无法使用file_get_contents('php:// input')并且在php.ini中禁用了always_populate_raw_post_data,因此我无法使用$ HTTP_RAW_POST_DATA。

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.

例如我在facebook上设置了回拨网址。因此,当有事件发生时,Facebook会将信息发布到我网站的特定网址。

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.

所以我需要阅读facebook上的原始帖子数据并根据上面的描述我想知道php:// input和$ HTTP_RAW_POST_DATA的替代方案。

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.

当有些正文发布到我的网站时可以读取总内容,包括标题,以便我可以剥离标题部分,并可以使用帖子的主体?

是的...我们可以得到完整的内容,当一些正文发布任何内容。

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

推荐答案

file_get_contents()被禁用时可以使用 PEAR :: PHP_Compat 的强大功能。它包含 file_get_contents()的替代。

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');

这篇关于当file_get_contents和always_populate_raw_post_data被禁用时,php:// input和$ HTTP_RAW_POST_DATA的替代方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆