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

Friday, February 11, 2022

[FIXED] Facebook PHP separate array

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

Issue

I am trying to get the name of the person who has posted the post, but I don't understand how to get the name from the array.

Here is the full code: http://pastebin.com/88ADm5Uw

This is the line I have a problem with:

echo "FROM: " . print_r($post['from']) . '<br>';

This line returns two values(id and name) and I want to only print out the name. Please help!:

EDIT: Any way to get the profile picture?


Solution

Try this:

echo "FROM: " . print_r($post['from']['name']) . '<br>';

You can see the complete JSON here:

https://developers.facebook.com/tools/explorer?method=GET&path=me%2Fhome



Answered By - Sahil Mittal
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

1,218,318

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 © 2025 PHPFixing