Home
»
php
» How to decode JSON using PHP5 for Facebook application
11 December 2013
How to decode JSON using PHP5 for Facebook application
The new Graph API helps to read and write data to Facebook. Every object in the social graph has a unique ID. You can fetch the data associated with an object by fetching https://graph.facebook.com/ID.For example, the official page for the Facebook Platform has id 19292868552, so you can fetch the object at https://graph.facebook.com/19292868552 All responses are JSON objects. Here is the code to decode JSON OBJECT / to get data from the graph api link .
Code Sample : //FETCHING THE JSON FROM THE URL
// THIS PRINTS THE WHOLE STRING OF JSON
// ITS SAME AS YOU ARE USING it as an object
//PRINTS THE FIRST NAME OF THE LOGGED IN USER
You can also directly use the graph api for showing the profile picture. For example :
No comments:
Post a Comment