Cazpa.com PHP Developer & Website Designer

12Nov/091

How to make Facebook Application

This is probably the most basic app you will ever make, this is a good place to start if you are new to making apps.

You will need to download the PHP client libraries from Facebook, this should consist of:

/facebook.php
/facebook_desktop.php
/facebookapi_php5_restlib.php
/jsonwrapper/jsonwrapper.php
/jsonwrapper/jsonwrapper_inner.php
/jsonwrapper/JSON/JSON.php
/jsonwrapper/JSON/LICENSE

In this example I have placed these is a folder called "client" this will keep everything tidy and seperate from the files in the root.

Next thing you need to do is:

    Visit the Facebook developers page
    You will see a button on the top right hand side saying "Set Up New Application" Click this button.
    Enter your desired name for the application and accept the terms and conditions.
You will now see a page with many many settings and details on, for now we are only interested in the "essential informaton" and this is:
  • Application Name
  • Application ID
  • API Key
  • Secret

Now for the script, this is pretty self explanatory, all you need to do is use the essential information (API key and secret) to fill in the variables on this script then upload it to your server where the application will be hosted.

<?php
//add your api key here
$api_key = '';
//add your secret here
$secret  = '';
//include facebook.php from the PHP client libraries folder
include_once 'client/facebook.php';
//initiate the class
$facebook = new Facebook($api_key, $secret);
//require the user to login
$user = $facebook->require_login();
/*----- All of the above is required-----*/
//welcome message
echo "Hi ";
?>
<fb:name firstnameonly="true" uid="loggedinuser" useyou="false"></fb:name>
<?php
echo " your basic app is working!";
?>

Now this is completed and uploaded you need to go back to Facebook and click on the "canvas" tab on the right, you will now see a section that says "required URLs". You now need to choose a Facebook url.

Then you need to enter the url to the page above that you have uploaded to your server.

You can now test your first Facebook application!

No related posts.

About Daniel Smith

I am the boss around here, if you need anything then send me a message :))

Popular Content & Keywords

add update delete in php,depositfiles hack,warning: mail() [function mail]: smtp server response: 554 the message was rejected because it contains prohibited virus or spam content in,rails vs php performance,add update delete records from sql server using php,php define variable,php add update delete,php tutorial deutsch,warning: mail() [function mail]: smtp server response: 554 the message was rejected because it contains prohibited virus or spam content,tutorial create contact form in dreamweaver php,ruby on rails vs php 2010,php tutorial // user registration w/ sql,,send emails with a web form: php scripting,php tutorial - register form insert into database
Comments (1) Trackbacks (0)
  1. I will be adding more tutorials very soon on how to add more functionality to the application and include how to use PHP with FBML .


Leave a comment

You must be logged in to post a comment.

No trackbacks yet.

Powered by WordPress Lab