Getting Facebook status messages of a page I own - php

Say I have a page on Facebook and updating its status and posting on its wall.
What I want is getting that data in json or xml format and use it on my own web page.
All the api docs I've read so far requires an access token, which I shouldn't need.
Twitter has a rest api like http://twitter.com/statuses/user_timeline/twitter_username.json?count=10, which returns the data in json format. I need something like that.

Almost all Facebook graph API calls require an access token, including the page feed you seek. You can get the feed in json format like: https://graph.facebook.com/pageIdOrName/feed or https://graph.facebook.com/pageIdOrName/statuses but you will need to append an access_token querystring parameter. You can test this with the Facebook Graph API explorer, and you could even use that access_token if you don't want to create an application.

Related

Why do I need a userAccessToken for /statuses request?

Using the PHP SDK, I am trying to query for the statuses of a page. But the Graph Explorer returns an error (#100) Requires user session. Why is that? Querying for the feed of the page works without user authorization and statuses are just a subset of the feed, aren't they?
Is there any way I can extract from /feed or /posts what /statuses would return?

Get Twitter userid from access token only

This may be duplicated with other articles, but I can't figure out how to do it after reading all of those.
I'm working on a back-end project in PHP and we are isolated from the front-end. According to the documentation from the front-end team, they will pass an access token and need the back-end to pull userid from Twitter's server.
Is there any way to do it? I could pull the data if I have oauth_signature and oauth_nonce, but they only give us the access_token.
I could pull the data if I have oauth_signature and oauth_nonce
That's not correct. oauth_signature is generated based on the application secret and request parameters. oauth_nonce is just a random string
So you need to get access_token and access_token_secret and perform a GET account/verify_credentials request
Further reading:
https://dev.twitter.com/docs/auth/implementing-sign-twitter
https://www.rfc-editor.org/rfc/rfc5849

Custom Activity Feed for Facebook Page

Research and Reasoning
I haven't worked on a Facebook Application for a while, thus am a little rusty with how the Graph API works.
I have had a look at various topics and pages such as:
https://developers.facebook.com/docs/reference/plugins/activity/
How to Style Facebook Activity Feed
From what I can gather, getting the activity of a facebook page is pretty simple, however, before I proceed, there are a few things I would like to iron out before to ensure I build the app or write the script in the best possible way...
My Question
I would like to gather the status updates of a Facebook Like page and then feed this data to my News page on the website I am building.
My method would be a simple call to the Graph API to gather the data, and then display it on screen.
My question is, can I do this without creating a Facebook App, and therefore do I even need the PHP SDK?
Is it possible to achieve it like so and are there any request limits:
$url = 'https://graph.facebook.com/LIKE_PAGE_ID/feed';
$result = json_decode(file_get_contents($url));
If the above is the correct answer to this question then please let me know and I will close this question
Update
I have tried the above URL with my like page and it says that I need an Access Token. This is what I feared... Is it possible to get this data without being logged in, and without having set up a Facebook Application?
Why not create a Facebook app and use App Access Token to retrieve the feed for the Public pages.
Though you might get feed of some pages without app access token or response for different end points without access_token, but as the Facebook's API is constantly changing, and would finally settle with authorized request to their end points, I would suggest you to use the App Access Token which is can be created with the format
App_ID|App_Secret
So instead of your call for $url that you had you can change it to
$url = 'https://graph.facebook.com/LIKE_PAGE_ID/feed?access_token=App_ID|App_Secret';
Which you can then json_decode. Also there is nothing on binding to use PHP SDK, and in your case, it is not even required.

Facebook api graph doesn't return me all the feeds

The graph api (feed) isn't showing me all what I need. I mean like when I did a post here, I got an alert on realtime updates (object: user, fields: feed) but when I sending request to graph api with my id and my access token I just not able to see it. It the same for when I do likes to people pictures / statues etc..
https://developers.facebook.com/docs/reference/api/realtime/
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Ffeed
Lint the access token and ensure you have read_stream permissions on it.

how to get a page owner feeds by facebook graph API

i'm trying to get a facebook page feeds using graph URL. but i want to get only the owner data ... i don't want anything not from the owner. i can do that using PHP. but i'm asking if i can do that using the same graph request.
Thanks
Just use /posts instead of /feed

Categories