使用 Facebook Graph API + PHP SDK获取用户的关于数据
使用Facebook Graph API和PHP SDK,我知道我可以获取用户的兴趣
$facebook->api("/me/interests")
但是,假设我有权限,我如何获取用户的关于数据?
$facebook->api("/me/about")
//gives error:
Fatal error: Uncaught OAuthException: Unknown path components: /about thrown in
[...]/base_facebook.php on line 1028
如何获取登录用户的 Facebook About 数据?谢谢。
编辑:这是应用程序权限的图片,以及用于请求权限的代码。
$login_url = $facebook->getLoginUrl(array( 'scope' => 'email, publish_stream,
user_about_me, user_interests, user_education_history'));
Using the Facebook Graph API and the PHP SDK, I know that I can get the user interests with
$facebook->api("/me/interests")
However, assuming that I have the permission to, how can I get the user's About data?
$facebook->api("/me/about")
//gives error:
Fatal error: Uncaught OAuthException: Unknown path components: /about thrown in
[...]/base_facebook.php on line 1028
How can I get the logged in user's Facebook About data? Thanks.
EDIT: Here's a picture of the app permissions, as well as the code used to request the permissions.
$login_url = $facebook->getLoginUrl(array( 'scope' => 'email, publish_stream,
user_about_me, user_interests, user_education_history'));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
取决于您想要什么“关于”信息?您可以指定各个字段,但没有总体的 about 命令来获取所有有关信息。 //
你可以从 http://developers.facebook.com/docs/reference/api/user/" rel="nofollow">http: /developers.facebook.com/docs/reference/api/user/
编辑,如果您想要简介,只需在字段中添加“,bio”即可
Depends what 'about' information you want? You can specify individual fields but there is no overall about command to get all about information. Just go
You can get a full list of what you can request plus further commands from http://developers.facebook.com/docs/reference/api/user/
Edit, if you are wanting the bio just add ',bio' to the fields
当您未正确登录您的
开发者
帐户时,通常会发生此类错误未知路径组件:/xxx
。这听起来似乎很明显,但我也遇到过类似的问题,直到习惯在工作前检查/更改帐户。 {>_<}
That kind of errors
Unknown path components: /xxx
usually occur when you are not properly logged in yourdeveloper
account.It may sound obvious, But I had similar problems until habituate to check/change accounts before work. {>_<}
我认为这应该是:
编辑:
只需使用这个:
您可以从中获取所有用户信息。只需解析数组以获取所需的内容即可。它输出所有与用户相关的信息
出于防止垃圾邮件的原因,某些属性(例如用户电话、地址)特意且故意不通过 API 提供。 Facebook 不允许他们通过 api
尝试一下:)
I think this should be :
EDIT:
Just Use this:
You can get all user information from this . Just parse the array for what you required . It outputs all the user related information
Some attributes like users phone,address are specifically and intentionally not available via the API, for spam prevention reasons . Facebook does not allow them to take through api
Try with this :)