Saturday, March 9, 2013

Facebook Programming: Facebook API



http://stackoverflow.com/questions/6390745/learning-resource-for-facebook-api

http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/
http://ow.ly/url/shorten-url
http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/
http://careers.stackoverflow.com/jobs/telecommute
http://www.phpeveryday.com/articles/Facebook-Programming-Facebook-API-P850.html

http://programmers.stackexchange.com/questions/64171/which-is-the-best-book-to-learn-facebook-app-development-and-facebook-graph-api











Facebook Programming: Facebook API



Facebook Application Programming Step by step tutorial - part 3. In the previous post, you have tried to create a simple Facebook application. You also use Facebook API. API is a means to communicate between programs. For example, in the previous exercise, you create a program to display a list of friends on Facebook. You can make these programs because of the API. You use Facebook API to display data from Facebook servers.
Currently, the API is the trend in the programming world. Not only are making Facebook API. Google, Amazon, Yahoo, and others also provide an API. With this API, you can create applications by using the features or existing data on their servers.

Calling API

In this post, we will discuss further the API that is on Facebook. We will start from analyzing the program code that we wrote earlier. We'll see, where we use the Facebook API.
01
02
03// Get these from http://developers.facebook.com
04$api_key = '2c73ae8529134aaaaaaaaaaaaaaaaaaa';
05$secret  = '3c041a7cbd797aaaaaaaaaaaaaaaaaaa';
06
07include_once './facebook-platform/php/facebook.php';
08
09$facebook = new Facebook($api_key, $secret);
10$user = $facebook->require_login();
11
12?>
13

Yummie Tester

14Hello '' useyou='false' possessive='true' />!
15Your id : echo $user; ?>.
16
17You have several friends:
18
19$friends = $facebook->api_client->friends_get();
20?>
21
22
    23
    24foreach($friends as $friend){
    25    echo "

  • ";  
    26}
    27?>
    28
    Where do you call the Facebook API?
    This is the Object Oriented Programming (OOP). If you do not know about OOP in PHP, I recommend you read this post first. Let more deep understanding of the API. However, if you remain determined to continue to learn Facebook programming is also fine. With a little squeeze your brain, you will come to understand what it is OOP.
    Back again to the code above. At the beginning of the line, you are prompted to insert the API Key and secret codes. This kind of entering a username and password database.
    1$api_key = '2c73ae8529134aaaaaaaaaaaaaaaaaaa';
    2$secret  = '3c041a7cbd7aaaaaaaaaaaaaaaaaaaaa';
    next, we call Facebook client library:
    1include_once './facebook-platform/php/facebook.php';
    On the client library, there is a class code to access Facebook. You must call and initialize a Facebook class.
    1$facebook = new Facebook($api_key, $secret);
    Next, do check whether the user is already logged or not. If have login, you'll get the ID of the user. User ID is inserted into the variable $ user.
    1$user = $facebook->require_login();
    Well, pay attention to the next line:
    1$friends = $facebook->api_client->friends_get();
    This is where you begin to use the Facebook API. You call the method api_client(). Above, you call the Facebook API is called: friends.get. The results of the use of these APIs is a list of ID's friends are accommodated in the variable named $friends. Next you want to display in the browser with the code:
    1foreach($friends as $friend){
    2    echo "

  • ";  
    3}
    Maybe you're wondering, his name is friends.get, but why written friends_get()? Yes, for the PHP programming standards, Point (dot) replaced with underscores. Here's example:
    • Events.get written events_get()
    • Friends.get written friends_get()
    • Comments.get written comments_get()
    Previous: Facebook Programming: My First Facebook Application
    Next: Facebook Programming: API Friends



    Bookmark and Share Tag: facebook, api Category: PHP API Post : November 05th 2009 Read: 76,688
    Table of Content
    Facebook Programming

    First Application
    Facebook Platform
    First Facebook App

    Facebook API
    Facebook API
    API Friends
    API Events
    API Groups
    API Page
    API Users

    Facebook Markup Language
    6 Type of FBML
    FBML Users and Groups
    Content Conditionally
    fb:if-can-see
    fb:if-can-see-photo
    fb:if-is-app-user
    fb:if-is-friend-with-viewer
    Content in Profile Boxes
    fb:if and fb:switch
    UI Element and Widget
    Using UI Element
    Discussion Board
    Creating Wall in Application
    Building Request and Invitations

    No comments: