PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 27, 2022

[FIXED] How do I find out what user posted to my wall via the Facebook PHP SDK?

 February 27, 2022     facebook-graph-api, facebook-php-sdk, php     No comments   

Issue

I'm trying to find out the user ID or name for a user that left a post on my Facebook feed.

I'm developing a script to work out some stats about the "tie strength" or connectivity of me to my friends on Facebook. Part of this is doing counts on stats such as how many times a particular friend has posted on my wall. I can use the /me/feed and /me/posts end-points to figure out feed entries that I've posted and feed entries that other have posted on my wall. the only problem is, the wall posts from others doesn't have any identifying attributes so I can't figure out who made the post. Does anyone know if this is even possible via the Facebook API anymore?


Solution

When you call the /me/feed, you get an array of posts with their id.

Then you can use the /post/post-id endpoint to retrieve the information of the user.

For example, if your post-id is 1687441367965569, then you can call the following endpoint:

/1687441367965569?fields=from

And this would return a JSON like the following:

{
  "from": {
    "name": "First Name Last Name",
    "id": "1231231234123123"
  },
  "id": "1687441367965569"
}

For more information: https://developers.facebook.com/docs/graph-api/reference/v2.11/post



Answered By - Chin Leung
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing