Okay to create a new aplication on facebook, we will begin with developing the most basic application that ever be..!! This is just to realize some basic concepts on viewing facebook application on canvas page and other minor details.
Project : Hello world
Required : Web space(where you can host your application), BAsic knowledge of PHP and java.
- Create a new page on your website as hello-world.php and place it in your application directory of your site.(Create a application directory as “facebook” in the root of your site.)
- Download Client Library (This package has all the files that make up the official PHP Client Library, as well as a sample application)
- Unrar this folder in the root directory for your applications in your site.
- Now copy the code below and save it in your hello-world.php file.
$appapikey = ‘YOUR APPLICATION KEY’;
$appsecret = ‘YOUR APPLICATION SECRET YOUR’;
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();
// Greet the currently logged-in user!
echo “<p>Hello, <fb:name uid=\”$user_id\” useyou=\”false\” />!</p>”;
// This just uses a fb:name to recive your name and then display it. This is an example of signed canvas. You might hav to login to view your application page.
- Now configure Your application on facebook.
- Register a new application on facebook.
- In settings tab, Set Canvas page URL as “hello-world”(This does not support more than 20 characters and capital letters)
- And Callback URL as the absolute URL of the page we just saved.(hello-world.php)
- Wollah..you are done..with your first application on facebook.
- Now go to the canvas page url to check if everthings wqorking fine. If not don’t worry..just ask me..!!! It would work newayz..!!
This might not enerzige you a lot as this does not do many a things besides printing your name on the application page ( or the one who is viewing this page.) . But this builds your basic to get things going.
Now you can build any page in simple php and try to render it on canvas page. Keep trying..!!
Popularity: 20% [?]