B
B
bezzla2016-11-13 02:41:35
Facebook
bezzla, 2016-11-13 02:41:35

Pull and display post likes on a separate page on the site?

Colleagues, hello!
Very urgently, for one project, we need the ability to pull out the likes of a particular post from FB in real time. I need the number of likes to be displayed simply as a number on my website on a blank page, just a number that will be updated! And, it is desirable that you can share a like and a heart (as it is now done there). I re-read a lot of everything, got a token, api id, etc., but a complete mess in my head, since the person is unenlightened. Help me please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bezzla, 2016-11-13
@bezzla

It turned out to form a request and display the answer by type of likes! How can I make the code automatically update and display the actual data, and at the same time, so that it is in the form of ordinary numbers?)
Here is the code itself:
$request = new FacebookRequest(
$session,
'GET',
'/10154092833240172',
array (
'fields' => 'reactions.type(LIKE).summary(total_count).limit(0).as(like),reactions.type(LOVE).summary(total_count).limit(0).as(love) ,reactions.type(WOW).summary(total_count).limit(0).as(wow),reactions.type(HAHA).summary(total_count).limit(0).as(haha),reactions.type(SAD ).summary(total_count).limit(0).as(sad),reactions.type(ANGRY).summary(total_count).limit(0).as(angry)'
)
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question