Remove posts for user likes and user comments Facebook Graph API - php

I currently experimenting with HybridAuth and Facebook Graph API.
I get news feed from Facebook API with $fb->api()->api("/me/home?limit=10");.
But I get post with text "User likes" a photo or "User comments on status". How can I remove those posts from array with posts?
Just for notice, I get array with parameters for each post. Those posts which I want to exclude have "story_tags", and other does not have it.
Can you help me? Maybe my API call is wrong, or I should add something more in API call?

Related

Get Facebook post's comments using graph API by post URL

I like to get comments of a post by its URL but it seems its impossible by using graph API.
From my observations, I could find these types of posts URLs:
https://www.facebook.com/bbwbooks/photos/a.168788885097.122872.74209335097/10153736545150098/?type=3&theater
https://www.facebook.com/4thirteengroup/posts/1285218878169361
https://www.facebook.com/groups/semsari.malezi/permalink/1159959294084128/
or perhaps some other types.
Is there any idea, how its possible to get comments or at least the ID of the post from the url?
First use facebook developer section https://developers.facebook.com/tools/explorer/1021611514583622?method=GET&path=me%2Fposts%3Ffields%3Did%2Cobject_id%2Ccomments&version=v2.7
Select Application ,
Get access_token with user_posts access rights,
me/posts?fields=id,object_id,comments by calling this api ,you will get all posts with their comments

get likes and comments of facebook post after sharing it

User sharing contents in facebook like this,
https://www.facebook.com/sharer/sharer.php?u=https://myexample.com
After share complete, i want to fetch all comments and likes of that post.
Is it returning post_id? so may be we can fetch comments using post id by graph api?
How should i do that in php?
The sharer.php does not return anything. You can only use the Share Dialog if you want to get a Post ID, but:
Only available if the user is logged into your app using Facebook and
has granted publish_actions.
Source: https://developers.facebook.com/docs/sharing/reference/share-dialog#response

How to get most popular posts from facebook page using graph API

I wanted to fetch most popular posts from a facebook page using Graph API. I tried https://graph.facebook.com/%pageId%/posts, But with that API I am getting recent posts from page. I wanted to filter the result with most popular posts (i.e., most shared, liked and commented). Can any body help me out how to get the popular posts from the page using the graph API.
Thanks,
Siva.
You can't get popular posts directly from Facebook Graph API. You can fetch the posts using the Graph API (/{page-id}/posts), then count likes, shares or comments of a post by yourself (/{post-id}/likes, /{post-id}/comments, /{post-id}/sharedposts) and then sort all the posts.
References:
1.https://developers.facebook.com/docs/graph-api/reference/v2.3/object/comments
2.https://developers.facebook.com/docs/graph-api/reference/v2.3/object/likes
3.https://developers.facebook.com/docs/graph-api/reference/v2.3/object/sharedposts

Get Facebook id of person how tagged me on my timeline

Currently i'm working on a website for a client.
I want to show his latest Facebook wall posts on his website, also posts he is tagged in by others.
With the Facebook Graph i can get allot of data from the latest post like message, description, picture etc. But i just can't find or get the Facebook id of the person who tagged him in that post... Only his own Facebook id and the id's of the others persons who where tagged, but not the tagger (if that is even a word :P)
Can anybody help me with this?
I'm using /feed in the Facebook Graph to get the data from the posts on his wall
$fb_id = 'your-facebook-id';
$fb_token = 'my-acces-token'; // tokken obtained from Facebook graph explorer page
$fb_response = file_get_contents('https://graph.facebook.com/'.$fb_id.'/feed?access_token='.$fb_token);
$fb_array = json_decode($fb_response, true);
Thanks for your time!!
If I understand you correctly, you just need to find the ID of a user that posted a status update that tagged your client.
Do things as you were before, by collecting objects from the /user/feed edge. You should retrieve an ID for the status. With this, make another call to the Graph for /STATUS_ID. This will give you information about who posted the status along with other things.
https://developers.facebook.com/docs/graph-api/reference/v2.1/post
Note that this will only work for public posts with any valid access token. If the post is not public, you may not be able to retrieve the post with a user's access token that is not the original user who posted the status. Keep in mind that the docs specifically state:
Only posts whose authors have also granted read_stream permission to the app will be shown for /user/feed.

Facebook Graph API: How many facebook likes can I get for graph api?

How many facebook likes can I get for graph api (https://graph.facebook.com/uid/likes/) by one connection?
For example, I probably can get all facebook likes from a user who has liked 100 times.
But, can I get all facebook likes from a user who has liked 5,000 times?
Then, I guess set "paging" in response data from graph api (https://graph.facebook.com/uid/likes/).
Please tell me how many facebook likes can I get for graph api.
Thank you.
Yes, use the pagination links that come back in the Graph API response to page through the results

Categories