In previous post, I got the basic user information of the App user with the this line of codes:
$user = $facebook->api('/me');
This line of code simply make a call to the Graph API with the api() function of the Facebook class. This is equal sending a GET request to https://graph.facebook.com/(argument) to get the
required information, as illustrated with the diagram below:
Similarly we can get the friends of user in the same way with the following codes:
<?php $userFriends = $facebook->api('/me/friends'); print_r($userFriends); ?>
The calling to the api() function can also be illustrated with the diagram below:
Now we have some basic idea how to make a call to the api() function of the facebook class, we can do more interesting thing with the App.