Take the 2-minute tour ×

My code is like this:

$FBpage = file_get_contents('https://graph.facebook.com/me/feed?access_token='.$params['access_token']);
$FBdata = json_decode($FBpage);

The problem is that the "feed" returned contains only a small part of the information (a few friend adds and no posts with links). What is the url to get the home page news feed of current user? It can be pretty big so if you can also tell me how to get a certain number of feed entries or how to "page" through it.

I don't have problems with login or other, I am able to get the data just that I think the url is not the one I want. This is a basic question but however I just don't find info on google. Thanks in advance.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Facebook's documentation can be kinda misleading. Note there are multiple connections to the user object. https://developers.facebook.com/docs/reference/api/user/

  • feed: The user's wall.
  • home: The user's news feed.

LOL, when you call /me/feed, you're really getting the user's wall. when you call /me/home this is when you really get the new feed. Facebook likes to make it harder than it really is.

Note: some other ways to get stream items from a user graph object

  • links: The user's posted links.
  • posts: The user's own posts
  • statuses: The user's status updates.
share|improve this answer
add comment

A quick google revealed this guy's instructions: http://johndoesdesign.com/blog/2011/php/adding-a-facebook-news-status-feed-to-a-website/

"4) You can then access the Facebook data feed as JSON data at the following URL: ’https://graph.facebook.com/PAGE_ID/feed?access_token=ACCESS_TOKEN’, replacing PAGE_ID with your page, group or profile ID, and ACCESS_TOKEN with the Access Token you were given in step 3. Note: Your page, group or profile ID can be found in its URL. Eg. ’http://www.facebook.com/group.php?gid=102037668290′, the ID would be the numbers after the ‘gid?=’.

5) You can then display the feed using a little PHP.. something like this:

//Get the contents of the Facebook page
$FBpage = file_get_contents('https://graph.facebook.com/PAGE_ID/feed?access_token=ACCESS_TOKEN');
//Interpret data with JSON
$FBdata = json_decode($FBpage);
//Loop through data for each news item
foreach ($FBdata->data as $news )
//Explode News and Page ID's into 2 values
$StatusID = explode("_", $news->id);
echo '<li>'
//Check for empty status (for example on shared link only)
if (!empty($news->message)) { echo $news->message;}
echo '</li>'

Not sure if that helps, as it's pretty much what you've been doing. But he does say that this should get you standard text updates etc, as well, just no media content. "

share|improve this answer
I am already doing this. The problem is the urls i tried graph.facebook.com/me/feed?access_token=.. and graph.facebook.com/USER_ID/feed?access_token=.. return only a few feeds (actually only friend acceptance info) but no posts with links. Maybe it's some security setting, or I am missing something. –  Paul Rusu Feb 17 '12 at 12:00
add comment

Your Answer


