Book Image

Facebook Application Development with Graph API Cookbook

By : Shashwat Srivastava, Apeksha Singh
Book Image

Facebook Application Development with Graph API Cookbook

By: Shashwat Srivastava, Apeksha Singh

Overview of this book

<p>With a user base of nearly 800 million people, Facebook is the number one social networking platform. Applications can be created to interact with this huge user base in various ways both inside and outside Facebook. These applications, if developed effectively and efficiently, offer a free medium for promotion and publicity of a product or an organization.<br /><br />Facebook Application Development with Graph API Cookbook covers both the concepts and implementations necessary to develop Facebook applications and provides ready to use code for common scenarios faced by a developer while creating these applications. It incorporates the newly launched Facebook Graph API and also presents the reader with some intuitive ready to use applications.<br /><br />This book guides the reader step by step, from start to finish, through various stages of Facebook application development. It begins by exploring the Facebook application registration and discussing the verification and authentication technique. It then takes you through the various ways in which you can use Facebook Graph API for interacting with users such as posting on a user’s wall, tagging a user in a picture, etc. Accessing complex Facebook user data by formulating a series of queries, doing client side scripting and incorporating Facebook Dialog interface are some other features that have been incorporated in this book. Integration of various Facebook Social Plugins such as the like box in your web page has also been discussed. Further you will get to know the concept of virtual currency and how to programmatically derive Facebook analytics data. As the book progresses, you will learn to use and integrate many more advanced features in Facebook application development. The book contains ready to use code that can be deployed instantly. Towards the end, the book houses a variety of ready to use Facebook applications so as to help readers derive their own applications from them.</p>
Table of Contents (18 chapters)
Facebook Application Development with Graph API Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Deleting subscriptions


Facebook Graph API gives an option to delete subscriptions of our application, if we may find them redundant. Moreover, we can also delete subscriptions pertaining to a particular object, user, permissions, or page.

Getting ready

We should have already subscribed to some updates so that we can delete them.

How to do it...

We will create a PHP code snippet and use it to post our subscription deletion request to the Facebook server:

  1. Create a file named action_delete_subs.php and add the following code to it:

    <?php
  2. Include the configuration file:

      require_once 'config.php';
  3. Specify the arguments needed to post to the authorization URL in the $args array:

      $args = array('grant_type' => 'client_credentials','client_id' => $facebook->getAppId(),'client_secret' => $facebook->getApiSecret());
  4. Initialize cURL using the curl_init() function:

      $ch = curl_init();
  5. Set the authorization URL using the curl_setopt() function:

      $url = 'https://graph.facebook.com/oauth/access_token...