facebook graph api and file_get_contents = 403


facebook graph api and file_get_contents = 403

我正在尝试创建一个简单的脚本来从id获取用户配置文件数据。

例如

$link = json_decode(file_get_contents('http://graph.facebook.com/zuck'));
echo $link_>name;

问题在于,Facebook似乎正在限制这类请求。有时它正在工作,但有时我收到以下错误:

警告:file_get_contents(http://graph.facebook.com/zuck) [function.file-get-content]:无法打开流:HTTP 请求 失败!HTTP/1.0 403 禁止

尝试使用 curl 而不是 file_get_contents 并使用curl_error来查看为什么它返回 403。您可能会达到请求限制,这可能是它为您提供 403 的原因。