like_count for a facebook post - php

i am working on a social media management system, one thing we do is that we get the number of likes each post has, that used to work but after the updates of the previous 2 years
we are starting to get into troubles,
can you please give me the proper way of getting the like_count of facebook page posts and displaying them on the graph explorer?
ps: i don't want the FQL query to get the lke_counts

You can use the likes connection of a post to get the number of total likes a post has received. This will return a list of all people that have liked a post. To make it even easier for you, you can pass in the parameter summary with its value set to 1 to get the total count of likes.
Take this as an example URL
https://developers.facebook.com/tools/explorer/?method=GET&path=19292868552_10150189643478553%2Flikes%3Fsummary%3D1

Related

Retrieving Facebook Page Statuses with PHP

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.)

Get my posts on facebook manage page

I need get ME posts in one of my manage pages, with the new version of facebook sdk.
Example:
I'm manage on Page A, and add a post in my name Adexe Rivera, and in this page there are a lot of posts. So I want to filter only posts by Adexe Rivera.
I know for get posts on pages it's necesary /page/feed, but I need add the filter from user.
I tried with Graph Api Explorer, with this FQL:
SELECT source_id, actor_id, post_id, target_id, message FROM stream WHERE source_id = "PAGE_ID" AND actor_id = "MY_ID"
and get the information that I'm searching.
But I know that since v2.0 FQL not works for sdk, so that I need it's make the same like FQL works in this version of graph
I already tried what documentation said, but not get my posts.
A user access token is required to retrieve posts visible to that person.
Thanks in advance
Filtering is not possible, you can only use the existing endpoints and filter on your own after getting the entries. There are several different endpoints, make sure you are using the correct one. They are all documented very well: https://developers.facebook.com/docs/graph-api/reference/v2.4/page/feed
Also, an App Access Token should be enough to get access to the endpoints if it´s a public post on a non-restricted Page:
An access token is required to view publicly shared posts.
If you don´t know about Access Tokens, read those articles:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
Finally, it is not possible to use FQL giving me the expected result, so getting the "from" field in the /PAGEID/feed endpoint, and filtering the results, I get what I wanted.
Thanks for your answers and for their penalties, I have spent several days trying to maximize the performance of the SDK facebook.
Cheers

Facebook API - Check Likes and Comments of Post

Is there a way to check the number of likes and comments that a particular post has? I wanna display that number on my site so i need to reference the API somehow to get that result. I am looking for either a PHP or a javascript solution. This will also be done dynamically. I want to keep track of likes posted by my app to different users so I'm thinking i should store the post id when I make the post. Any ideas?
Each post in facebook has a specific Id
You can use graph api to grab this id and see all the comments, likes and shares of it.
You simply have to make a POST call and grab the produced JSON
More information can be found on the links below
http://graph.facebook.com/19292868552_10150189643478553
https://developers.facebook.com/tools/explorer/?method=GET&path=19292868552_10150189643478553
https://developers.facebook.com/docs/reference/api/post/

Get a list of all the shares of a facebook post

I can get a list of comments and likes just fine using the facebook sdk. But i can't
find a way to get a list of all the users that shared a post (i tried fql as well).
This is the code i used to get the likes:
$facebook = new Facebook($config);
$likes = $facebook->api('/THE_POST_ID/likes',
array('limit'=>9999999999));
At the time of writing this, Facebook Graph API allows you to get the count of shares of a post. Using your code, it would look like the following (please not that I'm not doing any exception handling here for keeping the example simple):
$facebook = new Facebook($config);
// fetch the post data.
$post = $facebook->api('/THE_POST_ID/');
// fetch the count of shares.
$sharesCount = $post["shares"]["count"];
Using the Graph API Explorer you can easily see that.
Unfortunately, the API does not provide a "shares" connection like it does for "likes" and "comments". See Post - Facebook Graph API Documentation for details.
On the other hand, there is a dirty hack for retrieving the list of users (only friends and people who shared publicly) who shared a specific post. The solution is explained on another thread: List of people who shared on facebook. But, I would never suggest using that solution.
Yes you can get list of all the shares of a facebook post.
by accessing:
https://graph.facebook.com/{POST_ID}/sharedposts?access_token={ACCESS_TOKEN}
See:
https://developers.facebook.com/docs/graph-api/reference/v2.5/post
I know you're looking to get at shares through the post_id, but can you settle for finding shares by page_id instead of post_id?
If you can, then you can use the following FQL to get the data you're looking for.
SELECT via_id, created_time, owner_comment
FROM link
WHERE owner = me()
You can then compare via_id against the posts author (page ID) to determine if this share came from the post author in question.
Unfortunately, there seems to be a bug with the data return where some of the via_ids come back as 0. There is a ticket in with Facebook which, at the time of this post, has been open for three weeks at medium priority. I have no idea if this issue is specific to my app or affects everyone, but that query might get you what you want.

Get number of twitter shares by url

I have a question about twitter counting. Everything is so blury about this.
Simply:
I have website with dynamic pages, button for tweet, people go to page, press tweet, it shows on they twitter, count on my page increase. but I need also on my backend to call to twitter and ask them how many shares i have already and count with that.
It is concept for voting. People by sharing to facebook and twitter are voting for the website, so i need to take those votes and count them together. Please dont recommend me scripts like "sharecount" i tried and it has a lot of issues, and its not reliable.
I can get easily likes from facebook but i dont seems to get how to get the number of shares from twitter.
Also if anyone can help me, is there a way to get shares from unique users ? I noticed that if i tweet the site 50 times, the counter is 50. I would like it to count 50 tweets from 1 user as 1.
Thanks for help!
See the private API method http://urls.api.twitter.com/1/urls/count.json?url=

Categories