tags:

views:

378

answers:

1

i am starting on a php based facebook app. the documentation at facebooks developer page is quite confusing.

i have chosen the iframe method for rendering the canvas page. i have made my app in php and is hosted on my server. now the app loads fine in apps.facebook.com canvas. but the thing is I am unable to make API calls work.

what i wanted to know is how to transform the xml/JSON data received from the api calls to valid user-readable data. i mean friends.get gives me a bunch of uids. now how to make them appear as valid user profile image thumbnails or links?

i am very new to this. so any help would be appreciated. i just need to know how to work with the facebook API.

A: 

Hi amit

I would suggest using FQL instead - building your FQL queries will help you understand much more what goes on in FB under the hood as well plus if you are good in SQL you can combine multiple queries to give you friends pics and their IDs from diff tables in one resultset...

Use the FB fqlquery function call and pass your required column names there - e.g. you can see your stream from the following table: http://wiki.developers.facebook.com/index.php/Stream%5F%28FQL%29 and you can issue queries according to the examples given here: http://wiki.developers.facebook.com/index.php/Fql.query

e.g. this gives me the newsfeed from stream table, for all my friends (only):

$logged_in_user = $facebook->get_loggedin_user();
select source_id, post_id, message, likes, created_time, updated_time from stream where source_id in (select uid from user where uid in (select uid2 from friend where uid1=' . $logged_in_user . ')) and filter_key=\'nf\' order by updated_time"

You can query the User FQL table for the picture URLs of your friends and display those URLs in image containers of the frontend lang of your choice: http://wiki.developers.facebook.com/index.php/User%5F%28FQL)

Use the Console for testing your queries: http://developers.facebook.com/tools.php

And use the MultiQuery http://wiki.developers.facebook.com/index.php/Fql.multiquery later when you are more comfortable using FQL queries

sami
but what should i do when i receive an xml data containing the uid 1240079. how can i translate the given uid into a user account?
amit
select first_name, last_name, pic_square from user where uid=1240079for other columns, see the details here: http://wiki.developers.facebook.com/index.php/User_%28FQL%29
sami