LonelyWebCrawler
LonelyWebCrawler

Reputation: 2906

Using Facebook Graph API + PHP SDK to get User's About data

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.

The Permissions for My App

$login_url = $facebook->getLoginUrl(array( 'scope' => 'email, publish_stream, 
user_about_me, user_interests, user_education_history'));

Upvotes: 2

Views: 5163

Answers (3)

Sabari
Sabari

Reputation: 6335

I think this should be :

$facebook->api("/me/bio") ;

EDIT:

Just Use this:

$facebook->api("/me") ;

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

Upvotes: 0

Igor Parra
Igor Parra

Reputation: 10348

That kind of errors Unknown path components: /xxx usually occur when you are not properly logged in your developer account.

It may sound obvious, But I had similar problems until habituate to check/change accounts before work. {>_<}

Upvotes: 0

Altrozero
Altrozero

Reputation: 103

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

$info = $facebook->api('/me?fields=id,email,work');

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

Upvotes: 3

Related Questions