i already found a way to get posts without an access token:
https://www.facebook.com/feeds/page.php?format=rss20&id=121136164607942
https://www.facebook.com/feeds/page.php?format=atom10&id=121136164607942
With the URLs above you can get the newest posts, but what about the older ones? I basicly wanna achive what facebook already got (load the newest posts and then there will be a button "load more"). Including an IFrame is not an option. I want to make the facebook posts responsive.
Does somebody know if theres a way to get the older posts? I already tried adding &offset=10 but it doesnt seem to affect anything.
The old Page Feed endpoint will stop working soon. Use /v2.3/{page_id}/feed instead, then you can also use the since parameter.
See
https://developers.facebook.com/docs/apps/changelog#v2_3_90_day_deprecations
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3#paging
Page RSS Feed endpoint - at https://www.facebook.com/feeds/page.php is now deprecated and will stop returning data from June 23, 2015. Developers should call the Graph API's /v2.3/{page_id}/feed endpoint instead. This returns JSON rather than RSS/XML.
Related
I'm new to the Facebook API with PHP, and so far, I've succeeded in retrieving all the posts for my feed. But, I want to retrieve only the posts I have published, so nothing I have shared (that's what's included when I use the /posts) nor do I want messages placed on my feed by someone else (that's what I get using /feed)
Below an example of my call:
$data = file_get_contents("https://graph.facebook.com/$page_name/posts?limit=$limit&access_token=$access_token");
Any thoughts on this? Should I be using the facebook PHP SDK, or can it be done with a file_get_contents?
I have tried the "&with=" location filter, but I have no idea what that should do. Also I have tried adding "?filter=" app_$app_id, but that had no effect either.
As per CBroe's comment, this is not possible and needs additional code.
I am trying to make a simple webpage that will just display the most recent, let's say 5, posts from a certain facebook page. I have tried so many ways to use the Facebook API, but no matter what I do, it either returns nothing, or I get an access denied message. I am an admin of the page.
What is the best way to do this with PHP? If there is no other way to get facebook posts, what is the best way to use the API?
I would also like to get the post URL, not the contents of the post.
I found a way using zapier.com. Thanks!
First, you need to get either the user/page access token. Then, you will be able to get the last 5 posts using: https://graph.facebook.com/{YOUR_PAGE_ID}/posts?access_token={YOUR_ACCESS_TOKEN}&limit=5
I'm using Graph API to fetch my page feeds. I call
$pageID/feed?fields=created_time,object_id,story_tags,story,full_picture,picture,message_tags,message,caption,child_attachments,attachments,description,admin_creator,from
It gives me the feeds in my page which is fine. But, I also want the list of posts where anyone has mentioned my page in their posts in their own walls. I have gone through https://developers.facebook.com/docs/graph-api/reference/v2.9 but could not find a way to do that. Does anyone has any idea if that is possible?
If yes, then how?
There is the /{page-id}/tagged endpoint; but that will only return posts by other pages that have tagged yours, and only if those pages are “authentic” (which likely means verified.)
And user posts are not available at all to your app, not even if they are public - unless the user explicitly granted your app permission to read their posts.
Having trawled the web for days, I cannot find an up-to-date, working method to retrieve a list of the latest statuses on a Facebook page.
On the status section of the Graph API, I am greeted with "This document refers to a feature that was removed after Graph API v2.3"
I can't get file_get_contents to work on Facebook pages as I'm presented with a Captcha
It's for competitor research, I only actually want:
Post date
Number of Likes/Share/Replies
I couldn't care less for the status content itself, just the metrics around it.
A JSON object would be great, but I'll take anything at this stage.
Anyone else managed to get this sort of data or know a way to use file_get_contents on Facebook pages?
Thanks.
A status is just a certain kind of post – so all you need to do is request the page’s feed (resp. posts) instead, and then check if their type is status.
I've just tried to access the post object to get like/favourite counts .etc and get "[message] => (#12) singular statuses API is deprecated for versions v2.4 and higher"
You need to use the “full” post id as you get it from the /feed or /posts endpoint – the combination of page-id, underscore, post-id. (At least that’s the current format, but someone from Facebook told me we should not rely on that, it might change at some point. Best if you really just use the full id, as the endpoint returns it.)
And since you are interested in overall number of likes only, not the individual likes, you could make a request like this,
{full_post_id}?fields=likes.summary(1).limit(0)
That requests the summary (contains total counts), and limits the number of individual likes returned to zero (so as not to request any unnecessary data.) It works the same for comments. But I think for shared posts there is no such counts, you will only get a list of posts (which might not be all, but only those you are allowed to see.)
I am fetching posts from a public facebook page that has several contributors including myself.
When I use the graph explorer I see all of the posts, but for some reason it strips posts that I personally share when I use the PHP SDK, but includes other peoples' posts.
Here is the graph explorer with all of the posts. The first post is not included in the result set with the PHP SDK. Graph Explorer Link
Did you check the posts across all pages, since there is a pagination? There is a method called getRequestForNextPage() in the FacebookResponse class, which will create the request for the next result set.