Ben Waine
Ben Waine

Reputation: 1648

Creating a leaderboard using Facebook APIs and the PHP SDK

I'm a new Facebook developer. I'm creating a game and want to include a leader board.

I'd like to build a fairly detailed leader board including the following information:

1) Name 2) Pic_Square or profile_pic 3) A general location (UK, USA or LONDON, NY) 4) Score

I'm aware of how to get a current users basic information from the either the old REST API or the Graph API. However from what I understand of the Facebook rules I can't store the information I want to use from the API.

This leads me to the conclusion I should be polling the Facebook API using the information I can store (FB user ID's). When querying the API for specific user ID's (the ones for the test users I have generated) API methods (user.getInfo and fql.query) return either just the ID of the user or the fields I have requested with null values.

When querying my own ID I can access all the data.

Are there any methods to obtain publicly available data via the any of the APIs?

Thanks for your help!

Ben

Upvotes: 0

Views: 1610

Answers (1)

serg
serg

Reputation: 111325

Why do you think that you can't store this info? On the user table page it even says:

You can cache this data and subscribe to real time updates on any of its fields which are also fields in the corresponding Graph API version.

If you request offline_access permission you would be able to get user information even when a user is not currently logged in to your app.

You should be able to get any user public info without permissions or access token by going to:

https://graph.facebook.com/<USER_ID>

To display avatar you can use this code:

<img src="https://graph.facebook.com/<USER_ID>/picture"/>

I don't think you would be able to get location without requesting extra permissions.

Upvotes: 2

Related Questions