HomePHP Page 5 - Facebook PHP API Applications: Basic Introduction
Getting an Application ID for Your Facebook API Applications - PHP
If you are a PHP developer interested in learning the PHP API applications of Facebook, then this tutorial can help you get started. Keep reading and you'll soon know not only how to add Facebook features to your website, but how to develop your own Facebook applications.
The two plug-ins and features discussed already do not require an API for you to implement them in your website. However, some applications will require it -- for example, if you need to allow users to log in to your website using their Facebook account.
Step 2. If you are logged in, Facebook Developer asks you for two things, your site's name and your site's URL.
Under Site Name, type your application name bound with your domain name. For example, if your domain name is php-developer.org, then it will be PHP Developer Apps.
Under Site URL, enter the full URL of your domain's home page, for example: http://www.php-developer.org/
Step 3. Click "Create Application."
Facebook will then provide the complete details for you to start your Facebook API Application, particularly the Application ID, Secret key, Application URL, and so forth. For backup, you can copy and paste this information in a text editor and save it safely to your hard drive.
API Implementation Flow Chart
To make the Facebook PHP API easy for you to understand, look at the flow chart below:
Say, for example, that you need to integrate Facebook into your website by allowing users to log in, and then your PHP application will grab user-related information from Facebook and display it on your website (or use it in your other applications).
It starts by checking to see if the user has been logged in. If the user is not logged in, a Facebook login button will be presented. Once the user has logged in, your PHP application will retrieve user-related information from Facebook.
In this process, Facebook will authenticate your PHP application using the Application ID and secret key (in addition to the Facebook Application URL you provided during registration).
Once authenticated, you can use file_get_contents PHP function to retrieve user information, so that your PHP web application can use that data on your own website.
In the second part of this tutorial, you will learn how to create an actual PHP web application implementing the above flow chart.