O'Reilly logo

Facebook Application Development with Graph API Cookbook by Apeksha Singh, Shashwat Srivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Developing an application to classify friends according to the cities they live in

In this application a user will be able to classify all of his/her friends according to the cities in which they currently reside.

Getting ready

You should have already created index.php and config.php as mentioned in the beginning of the third chapter. Additionally, you should also provide friends_location and user_location extended permission to the application.

How to do it...

The following steps will demonstrate the creation of this application:

  1. Open index.php and append the following code after the HTML <body> tag. Select the location, name, user ID, and profile picture of the user's friends by using FQL:
    <?php $friends = $facebook->api(array('method' => 'fql.query', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required