Arun Rama Balan.G is Tech Lead of Zerosoft Technologies, Thooththukudi. I had received a bachelor degree in computer science from SBK College - Aruppukottai and Masters degree in Computer Application from VHNSN College - Virudhunagar. I found these below solutions from GOOGLE SEARCH. So I update this solutions from Out side sources. Not My OWN Contents. Credit goes to Original authors..
Monday, December 28, 2009
30 Innovative Social Bookmarks Icons
This article is a list of the best and most creative Social Bookmark Icon Sets for your web sites or blogs. If I have missed any, leave send me the link via the comments.
Wednesday, December 2, 2009
Anatomy of API
A Facebook application can take on many forms. However, to fully utilize the suite of integration points and deliver a full user experience, we recommend integrating your application into the following areas of the Facebook profile:
1. Application Directory
2. Application Profile
3. Canvas Page
4. Profile
1. Profile Boxes
2. Applications Menu
3. Bookmarks
4. Application Tabs
5. Boxes Tab
6. Application Info Sessions
7. Publisher
8. Feed Forms
5. Privacy Settings
6. News Feed
7. Alerts
8. Requests
9. User Dashboard
10. Interacting with Users
On this page, you'll see how our sample application Smiley integrates many of these various components. Note that none of these integration points are mandatory, but the more you include in your application the richer the user experience becomes
Application Directory
Many users may find your application by browsing the Facebook Application Directory. This is where beautiful imagery and concise, descriptive text pay off. You need to submit your application to Facebook so it can be included in the directory.
Application Profile
The Application Profile tells users about your application and is accessed from the Facebook Application Directory. It should inspire users to interact with your application. The profile is a Facebook Page
Canvas Page
This is the main page of your application on Facebook. Application canvas pages appear within the Facebook frame and can either be FBML (Facebook's version of HTML) or an external Web site presented within an iframe.
Profile
The Facebook profile is the online representation of a user's real world identity. We have included many integration points on the profile. This enables you to empower users to express themselves through your application.
Profile Box
The profile box is usually the place to show the most recently updated information or the most recent actions of the user. This information should reflect how the user would want to represent their identity through your application on their profile.
The user can choose to put your box on the main section of her profile (the Wall and Info tabs - see Smiley in the lower left corner of the image), or can put it on the Boxes tab (see below).
Applications Menu
The Applications menu is where users go to access your applications. They can bookmark applications, edit application settings, and go to their recently viewed and bookmarked applications.
Bookmarks
Bookmarks appear on every user's home page as well as on the Applications menu.
Application Tabs
Application tabs let users feature full canvas-like pages for applications they enjoy the most. Tabs behave like a hybrid of a canvas page and a profile box
More information about tabs and how they behave can be found on the Developers Wiki
Boxes Tab
The Boxes tab contains application profile boxes. Users can move profile boxes from the main profile to the Boxes tab and vice versa.
Application Info Sessions
The Info tab on the profile allows users to express their interests in a more structured way than before. Users can add structured information from your applications by way of application info sections. An application info section is a list of text and/or images provided by your application.
When a user chooses to add an application info section, you set the format with the profile.setInfo API call.
Publisher
Applications can integrate into the Publisher so users can create or find rich content and post it directly into their own or their friends' Walls. And these stories can leverage any of the new Feed story sizes — see below for more details.
Feed Forms
Feed forms are special FBML components that allow applications to publish Feed stories on the behalf of users. Your application can publish directly into the user's and the user's friends' Mini-Feeds.
Privacy Settings
Users can set their privacy options from your application's privacy/settings page. These options include approval for publishing stories...
... and whether the user wants to add or remove your application's profile box, tab, and info section, and who can see these elements.
A user can also decide whether to add a bookmark for your application. Bookmarks appear on the Applications menu — see above.
News Feed
Applications can access News Feed and post stories to it. Each user has a maximum number of News Feed stories that they can see from all applications. Once that maximum is reached they cannot see any more application stories during that sweep. For example, the Photos application publishes News Feed stories about photos your friends have uploaded recently.
You send News Feed stories as notifications; use Notifications.send.
In addition, your application can post stories directly onto users' profiles by using Feed forms (see above).
Alerts
Applications can send notifications to a user through email. Users must grant your application permission before they can receive email. The user of the application who triggers this action must approve of the email. You send email with notifications.sendEmail.
Requests
Applications can create requests that show up at the top right of a user's homepage. These requests are usually initiated by a user's friend and often require the user to take some form of action. An example of this in the Photos application is a photo tag request confirmation.
Like News Feed stories, requests are also sent in the form of notifications, so use notifications.send.
User Dashboard
The user dashboard is usually accessed at the top of the application's canvas page. This is where users manage their own content within an application or see information about another user's content within that application.
To create a dashboard, use the fb:dashboard FBML tag.
Interacting with Users
While the current version of the API does not support performing Facebook-specific actions directly, you can direct your users to various Facebook pages to perform an action. To do this, link the user to one of the following pages:
To... Use this URL...
View the specified user's profile. http://www.facebook.com/profile.php?id=XXXXX
Poke the specified user. http://www.facebook.com/poke.php?id=XXXXX
Send a message to the specified user. http://www.facebook.com/message.php?id=XXXXX&subject=XXXXX&msg=XXXXX
Note: {{c|subject}} and {{c|msg}} parameters are optional ways to pre-fill the contents of the message (the user will still be able to edit the message before sending).
Add the specified user as a friend. http://www.facebook.com/addfriend.php?id=XXXXX
See photos taken by the specified user. http://www.facebook.com/photos.php?id=XXXXX
Read or post on the specified user's Wall. http://www.facebook.com/wall.php?id=XXXXX
Read the specified user's notes. http://www.facebook.com/notes.php?id=XXXXX
Note: Facebook doesn't look fondly upon spammy behavior, so please don't encourage your users to abuse this functionality.
1. Application Directory
2. Application Profile
3. Canvas Page
4. Profile
1. Profile Boxes
2. Applications Menu
3. Bookmarks
4. Application Tabs
5. Boxes Tab
6. Application Info Sessions
7. Publisher
8. Feed Forms
5. Privacy Settings
6. News Feed
7. Alerts
8. Requests
9. User Dashboard
10. Interacting with Users
On this page, you'll see how our sample application Smiley integrates many of these various components. Note that none of these integration points are mandatory, but the more you include in your application the richer the user experience becomes
Application Directory
Many users may find your application by browsing the Facebook Application Directory. This is where beautiful imagery and concise, descriptive text pay off. You need to submit your application to Facebook so it can be included in the directory.
Application Profile
The Application Profile tells users about your application and is accessed from the Facebook Application Directory. It should inspire users to interact with your application. The profile is a Facebook Page
Canvas Page
This is the main page of your application on Facebook. Application canvas pages appear within the Facebook frame and can either be FBML (Facebook's version of HTML) or an external Web site presented within an iframe.
Profile
The Facebook profile is the online representation of a user's real world identity. We have included many integration points on the profile. This enables you to empower users to express themselves through your application.
Profile Box
The profile box is usually the place to show the most recently updated information or the most recent actions of the user. This information should reflect how the user would want to represent their identity through your application on their profile.
The user can choose to put your box on the main section of her profile (the Wall and Info tabs - see Smiley in the lower left corner of the image), or can put it on the Boxes tab (see below).
Applications Menu
The Applications menu is where users go to access your applications. They can bookmark applications, edit application settings, and go to their recently viewed and bookmarked applications.
Bookmarks
Bookmarks appear on every user's home page as well as on the Applications menu.
Application Tabs
Application tabs let users feature full canvas-like pages for applications they enjoy the most. Tabs behave like a hybrid of a canvas page and a profile box
More information about tabs and how they behave can be found on the Developers Wiki
Boxes Tab
The Boxes tab contains application profile boxes. Users can move profile boxes from the main profile to the Boxes tab and vice versa.
Application Info Sessions
The Info tab on the profile allows users to express their interests in a more structured way than before. Users can add structured information from your applications by way of application info sections. An application info section is a list of text and/or images provided by your application.
When a user chooses to add an application info section, you set the format with the profile.setInfo API call.
Publisher
Applications can integrate into the Publisher so users can create or find rich content and post it directly into their own or their friends' Walls. And these stories can leverage any of the new Feed story sizes — see below for more details.
Feed Forms
Feed forms are special FBML components that allow applications to publish Feed stories on the behalf of users. Your application can publish directly into the user's and the user's friends' Mini-Feeds.
Privacy Settings
Users can set their privacy options from your application's privacy/settings page. These options include approval for publishing stories...
... and whether the user wants to add or remove your application's profile box, tab, and info section, and who can see these elements.
A user can also decide whether to add a bookmark for your application. Bookmarks appear on the Applications menu — see above.
News Feed
Applications can access News Feed and post stories to it. Each user has a maximum number of News Feed stories that they can see from all applications. Once that maximum is reached they cannot see any more application stories during that sweep. For example, the Photos application publishes News Feed stories about photos your friends have uploaded recently.
You send News Feed stories as notifications; use Notifications.send.
In addition, your application can post stories directly onto users' profiles by using Feed forms (see above).
Alerts
Applications can send notifications to a user through email. Users must grant your application permission before they can receive email. The user of the application who triggers this action must approve of the email. You send email with notifications.sendEmail.
Requests
Applications can create requests that show up at the top right of a user's homepage. These requests are usually initiated by a user's friend and often require the user to take some form of action. An example of this in the Photos application is a photo tag request confirmation.
Like News Feed stories, requests are also sent in the form of notifications, so use notifications.send.
User Dashboard
The user dashboard is usually accessed at the top of the application's canvas page. This is where users manage their own content within an application or see information about another user's content within that application.
To create a dashboard, use the fb:dashboard FBML tag.
Interacting with Users
While the current version of the API does not support performing Facebook-specific actions directly, you can direct your users to various Facebook pages to perform an action. To do this, link the user to one of the following pages:
To... Use this URL...
View the specified user's profile. http://www.facebook.com/profile.php?id=XXXXX
Poke the specified user. http://www.facebook.com/poke.php?id=XXXXX
Send a message to the specified user. http://www.facebook.com/message.php?id=XXXXX&subject=XXXXX&msg=XXXXX
Note: {{c|subject}} and {{c|msg}} parameters are optional ways to pre-fill the contents of the message (the user will still be able to edit the message before sending).
Add the specified user as a friend. http://www.facebook.com/addfriend.php?id=XXXXX
See photos taken by the specified user. http://www.facebook.com/photos.php?id=XXXXX
Read or post on the specified user's Wall. http://www.facebook.com/wall.php?id=XXXXX
Read the specified user's notes. http://www.facebook.com/notes.php?id=XXXXX
Note: Facebook doesn't look fondly upon spammy behavior, so please don't encourage your users to abuse this functionality.
Get Started - Face Book API
Now that you know a little bit about Facebook Platform, you're probably eager to start building an application. You can get a basic application up and running in minutes.
Before we begin, there are a few things you need to know. In order to create a Facebook application, you should know or need the following:
* You should be well versed in PHP or some other coding language — such as Ruby on Rails, JavaScript, or Python — especially one that has a client library for our API.
* You need to have a basic understanding of the Internet, SSH, MySQL, and Unix
* You need to be familiar with Web hosting fundamentals and have a place to host your application. You can read some fundamentals about hosting here
Now you're ready to get started! You can read in depth instructions on the Facebook Developers Wiki, but this outline here should give you good enough idea to get you going.
Setting Up Your Application
1. First you need to log in to the Facebook Developer application:Go to the Facebook Developer AppAfter following the link, click “Allow” to let the Developer application access your profile.
2. Begin setting up a new application. Go to the Developer application and click “Set Up New Application”. Give your application a name, check to accept the Terms of Service, then click Submit. You'll see some basic information about your application, including:
* Your API key: this key identifies your application to Facebook. You pass it with all your API calls.
* Your application secret: Facebook uses this key to authenticate the requests you make. As you can tell by its name, you should never share this key with anyone.
3. Now we need to configure a few more settings before we can get into the code. Click "Edit Settings". Notice that the support and contact email addresses are pre-populated with the email address associated with your Facebook account.
4. Enter a callback URL. This is the address where your application lives on your server, or the server where the application is being hosted.
5. Enter a canvas page URL. A canvas page is the address where your application lives on Facebook. When users access your application on Facebook, they're taken to your canvas page. It's a good idea to use your application name or something similar. It must be at least 7 characters long and include only letters, dashes and underscores.
6. You want users to be able to put your application on their profiles, so select “Yes” at “Can your application be added on Facebook?”
7. Believe it or not, this is all we really need to get a simple application ready to go. Click "Save and continue".
Configuring Your Application on Your Host
Before you configure your application on your server, you need to make sure your server is ready to host a Facebook application.
* If you're using a hosting service like Joyent, it actually comes with the Facebook PHP client library installed, along with MySQL and memcached.
* If you're not using a hosting service that provides you with a preconfigured environment for Facebook applications, then you need to upload the client library and install MySQL.
Once your host is configured, you can copy the sample code to the server:
1. Go back to the Developer application, and click the example code link under your application information. You'll see a basic PHP file, but notice that this sample code already includes your application's API key and secret.
2. Copy the contents of this file and paste it into a file called index.php on your server in the same directory where the Facebook client library resides.
3. Your application is ready for testing. Go back to a browser and enter your canvas page URL (or click the link in step 3 of the Quick Creation Guide in the Developer application).
4. You should see a page containing your first 25 Facebook friends.
And that's it. This was a simple demonstration on how to quickly build a Facebook application. It demonstrated some basic Facebook Platform concepts, as well as the Platform API and FBML, Facebook's markup language.
We didn't cover integration points, which is how you can weave your application deeper into Facebook so you can provide your users with a richer experience. Our sample application, Smiley, includes all the integration points. And you can see them explained in our anatomy of a Facebook application.
Need Help or Have Questions?
Facebook Platform is constantly evolving, so you need to keep up with the changes. The best ways to keep up with what we're doing is to:
* Check the Documentation and the Forum.
* Keep an eye on the Facebook Developers blog. The Developers blog runs all our major announcements. You can subscribe to the blog here.
* Read the Platform Status Feed. The status feed is where we send out various announcements and updates on the current state of Facebook Platform. You can subscribe to the status feed here.
Finally, every week we push our code out to our developers a day before we release it to our users, so you can test your application against the new changes. You can point your application to the beta site, www.beta.facebook.com.
Before we begin, there are a few things you need to know. In order to create a Facebook application, you should know or need the following:
* You should be well versed in PHP or some other coding language — such as Ruby on Rails, JavaScript, or Python — especially one that has a client library for our API.
* You need to have a basic understanding of the Internet, SSH, MySQL, and Unix
* You need to be familiar with Web hosting fundamentals and have a place to host your application. You can read some fundamentals about hosting here
Now you're ready to get started! You can read in depth instructions on the Facebook Developers Wiki, but this outline here should give you good enough idea to get you going.
Setting Up Your Application
1. First you need to log in to the Facebook Developer application:Go to the Facebook Developer AppAfter following the link, click “Allow” to let the Developer application access your profile.
2. Begin setting up a new application. Go to the Developer application and click “Set Up New Application”. Give your application a name, check to accept the Terms of Service, then click Submit. You'll see some basic information about your application, including:
* Your API key: this key identifies your application to Facebook. You pass it with all your API calls.
* Your application secret: Facebook uses this key to authenticate the requests you make. As you can tell by its name, you should never share this key with anyone.
3. Now we need to configure a few more settings before we can get into the code. Click "Edit Settings". Notice that the support and contact email addresses are pre-populated with the email address associated with your Facebook account.
4. Enter a callback URL. This is the address where your application lives on your server, or the server where the application is being hosted.
5. Enter a canvas page URL. A canvas page is the address where your application lives on Facebook. When users access your application on Facebook, they're taken to your canvas page. It's a good idea to use your application name or something similar. It must be at least 7 characters long and include only letters, dashes and underscores.
6. You want users to be able to put your application on their profiles, so select “Yes” at “Can your application be added on Facebook?”
7. Believe it or not, this is all we really need to get a simple application ready to go. Click "Save and continue".
Configuring Your Application on Your Host
Before you configure your application on your server, you need to make sure your server is ready to host a Facebook application.
* If you're using a hosting service like Joyent, it actually comes with the Facebook PHP client library installed, along with MySQL and memcached.
* If you're not using a hosting service that provides you with a preconfigured environment for Facebook applications, then you need to upload the client library and install MySQL.
Once your host is configured, you can copy the sample code to the server:
1. Go back to the Developer application, and click the example code link under your application information. You'll see a basic PHP file, but notice that this sample code already includes your application's API key and secret.
2. Copy the contents of this file and paste it into a file called index.php on your server in the same directory where the Facebook client library resides.
3. Your application is ready for testing. Go back to a browser and enter your canvas page URL (or click the link in step 3 of the Quick Creation Guide in the Developer application).
4. You should see a page containing your first 25 Facebook friends.
And that's it. This was a simple demonstration on how to quickly build a Facebook application. It demonstrated some basic Facebook Platform concepts, as well as the Platform API and FBML, Facebook's markup language.
We didn't cover integration points, which is how you can weave your application deeper into Facebook so you can provide your users with a richer experience. Our sample application, Smiley, includes all the integration points. And you can see them explained in our anatomy of a Facebook application.
Need Help or Have Questions?
Facebook Platform is constantly evolving, so you need to keep up with the changes. The best ways to keep up with what we're doing is to:
* Check the Documentation and the Forum.
* Keep an eye on the Facebook Developers blog. The Developers blog runs all our major announcements. You can subscribe to the blog here.
* Read the Platform Status Feed. The status feed is where we send out various announcements and updates on the current state of Facebook Platform. You can subscribe to the status feed here.
Finally, every week we push our code out to our developers a day before we release it to our users, so you can test your application against the new changes. You can point your application to the beta site, www.beta.facebook.com.
Facebook PHP Tutorial
Facebook Is The New Black.
Everyone is talking about Facebook and their new Application Platform:
* Techcrunch – Facebook Launches Facebook Platform; They are the Anti-MySpace
* Mashable – Facebook Powertools: 150+ Apps, Scripts and Add-ons for Facebook
* Digg – The Impact of Facebook’s Platform
* Mashable – Facebook Platform: 30+ Awesome Applications for Facebook
* Valleywag – Developers, beware. Facebook really is the new Microsoft.
* Facebook’s Blog Post on the Facebook Platform
* Inside Facebook – Hottest Facebook Apps: July 28th
And I have to admit I think it’s pretty cool too. So I decided to create an application that uses the Facebook Platform. I’m writing the application in PHP and I thought it might be useful for others to know how to write their own Facebook applications with PHP. So here we are.
What Will I Learn?
I will cover the basics of using the Facebook PHP library and how to get your application started, including:
1. Installing The Facebook Developer Application
2. Downloading The Facebook PHP Client Library
3. Creating Your Application
4. Hello Facebook! Example
5. FBML – Facebook Markup Language
6. Using the Facebook API
F8 Logo
Getting Started As A Facebook Developer
The first thing you need of course is a Facebook account. You can sign up for Facebook at www.facebook.com. Once you have your account you’ll need to install the Facebook developer application. This little tool will allow you to generate your application profile and get an API key (more on that later). Once you’ve logged into Facebook visit: www.facebook.com/developers/ or click below to install the developer application:
Facebook Developer Icon Add The Facebook Developer Application.
PHP Facebook API Client Library
Facebook has created a nice php library that allows you to use their API without writing a lot of extra code. You can grab the PHP version of the library at developers.facebook.com/resources.php. Download the ‘PHP (4 and 5) Client Library’.
Once you’ve downloaded the library unzip it into a folder that is accessible by your PHP scripts. So you would have something like /php_include_directory/facebook/ and in that folder you will have the entire Facebook PHP Client Library (3 folders: client, footprints, php4client). I’m using PHP5 so my examples will be using the “client” directory of the library. The footprints folder is an example application.
Creating Your Application Profile And API Key
Facebook Developer Set Up New Application
Facebook requires that you register each application you make. Once you’ve logged into Facebook and installed the developer application go to the developer panel (or click here). Inside the developer application click “Set Up New Application”.
Choose a name for your application. This is important because it’s what users will see when they are browsing the application directory. Currently the name field is the only thing used when searching for applications. So it’s doubly important at this point.
Click on “Optional Fields”. Then fill out the Callback Url with the location of your script. This is the public URL on your webserver where the Facebook application will be.
Next fill out the “Canvas Page URL”. This is your application URL within Facebook. For example if the application was called “Makebeta Is Cool” then the application URL could be: “makebeta” which would make the full URL: http://apps.facebook.com/makebeta/.
Check Yes for Can your application be added on Facebook?
You should check the Developer Mode checkbox so that no one can add your application until you are done working on it.
Under Integration Points fill out Side Nav URL with the full Canvas Page URL. In the example above it would be http://apps.facebook.com/makebeta/. This allows users to add your application to their Facebook left side bar navigation.
All of these settings can be changed after the application has been created. But it’s a good idea not to change the Canvas Page URL or Name once you have users that have installed your application.
Further Reading: Starting your First Facebook App: Demystifying Application Form Field by Field
Facebook App Key
Get the API Key and Secret. You should now see your application listed with a unique API Key and Secret code. You’ll use these within your application.
Hello Facebook!
Let’s create a really simple first application that just says hello to the current Facebook user. Here’s the code for the Hello Facebook! application:
require_login();
/* now we will say:
Hello USER_NAME! Welcome to my first application! */
?>
Hello < fb:name uid='' useyou='false' possessive='true' />! Welcome to my first application!
Debug:" . print_r($facebook,true) . "";
?>
So what happens when a user hits the Canvas Page URL (from the example it would be: http://apps.facebook.com/makebeta/)? The require_login() call will produce a screen like this for the user:
Facebook Require Login Screen
If you change require_login() to require_add() the user will get a page that looks like this:
Facebook Require Add Screen
After the user logs into or adds the application they will get the canvas page with the “Hello…” text. It should look something like this:
Facebook Hello Screen
Facebook Markup Language – FBML
Facebook has provided a bunch of built in tags that will render dynamic data inside your application. All you have to do is include the tags with the correct parameters. In the example above the fb:name tag is used to generate the user’s name on the canvas page. fb:name has a couple of parameters, one of which is uid. In the example above we set uid = $fb_user which is the unique ID of the current user. There are lots of FBML tags you can use, check them all out at: developers.facebook.com/documentation.php?doc=fbml
Facebook API REST-based Interface
The Facebook Client Library provides you with an easy to use wrapper for the Facebook API REST interface. All of the API calls are available under the $facebook->api_client object (after you initiate the $facebook object). Many of the calls will require that the user has either added or logged into the application. Here’s an example call that would retrieve the user’s About Me text from their profile:
$fb_user = $facebook->user;
$about = $facebook->api_client->users_getInfo($fb_user,'about_me');
There are a number of API calls, and a list of them can be found here:
developers.facebook.com/documentation.php
Resources and Further Reading
These are very helpful pieces of information that I highly recommend reading before you get too far into making your Facebook application.
* Basic Facebook Application Architecture
* How URLs Are Handled Within An Application
* Understanding Your Callback Page
And of course the official documentation / developer site:
* Facebook Developers Site
* Facebook Developers Wiki
Other Facebook tutorials and how-to articles:
* Tucows – Getting Started With Facebook Application Development
* 10 Things That Would Have Been Nice to Know When Starting My Facebook Application
* Developing with the Facebook Platform and PHP
Everyone is talking about Facebook and their new Application Platform:
* Techcrunch – Facebook Launches Facebook Platform; They are the Anti-MySpace
* Mashable – Facebook Powertools: 150+ Apps, Scripts and Add-ons for Facebook
* Digg – The Impact of Facebook’s Platform
* Mashable – Facebook Platform: 30+ Awesome Applications for Facebook
* Valleywag – Developers, beware. Facebook really is the new Microsoft.
* Facebook’s Blog Post on the Facebook Platform
* Inside Facebook – Hottest Facebook Apps: July 28th
And I have to admit I think it’s pretty cool too. So I decided to create an application that uses the Facebook Platform. I’m writing the application in PHP and I thought it might be useful for others to know how to write their own Facebook applications with PHP. So here we are.
What Will I Learn?
I will cover the basics of using the Facebook PHP library and how to get your application started, including:
1. Installing The Facebook Developer Application
2. Downloading The Facebook PHP Client Library
3. Creating Your Application
4. Hello Facebook! Example
5. FBML – Facebook Markup Language
6. Using the Facebook API
F8 Logo
Getting Started As A Facebook Developer
The first thing you need of course is a Facebook account. You can sign up for Facebook at www.facebook.com. Once you have your account you’ll need to install the Facebook developer application. This little tool will allow you to generate your application profile and get an API key (more on that later). Once you’ve logged into Facebook visit: www.facebook.com/developers/ or click below to install the developer application:
Facebook Developer Icon Add The Facebook Developer Application.
PHP Facebook API Client Library
Facebook has created a nice php library that allows you to use their API without writing a lot of extra code. You can grab the PHP version of the library at developers.facebook.com/resources.php. Download the ‘PHP (4 and 5) Client Library’.
Once you’ve downloaded the library unzip it into a folder that is accessible by your PHP scripts. So you would have something like /php_include_directory/facebook/ and in that folder you will have the entire Facebook PHP Client Library (3 folders: client, footprints, php4client). I’m using PHP5 so my examples will be using the “client” directory of the library. The footprints folder is an example application.
Creating Your Application Profile And API Key
Facebook Developer Set Up New Application
Facebook requires that you register each application you make. Once you’ve logged into Facebook and installed the developer application go to the developer panel (or click here). Inside the developer application click “Set Up New Application”.
Choose a name for your application. This is important because it’s what users will see when they are browsing the application directory. Currently the name field is the only thing used when searching for applications. So it’s doubly important at this point.
Click on “Optional Fields”. Then fill out the Callback Url with the location of your script. This is the public URL on your webserver where the Facebook application will be.
Next fill out the “Canvas Page URL”. This is your application URL within Facebook. For example if the application was called “Makebeta Is Cool” then the application URL could be: “makebeta” which would make the full URL: http://apps.facebook.com/makebeta/.
Check Yes for Can your application be added on Facebook?
You should check the Developer Mode checkbox so that no one can add your application until you are done working on it.
Under Integration Points fill out Side Nav URL with the full Canvas Page URL. In the example above it would be http://apps.facebook.com/makebeta/. This allows users to add your application to their Facebook left side bar navigation.
All of these settings can be changed after the application has been created. But it’s a good idea not to change the Canvas Page URL or Name once you have users that have installed your application.
Further Reading: Starting your First Facebook App: Demystifying Application Form Field by Field
Facebook App Key
Get the API Key and Secret. You should now see your application listed with a unique API Key and Secret code. You’ll use these within your application.
Hello Facebook!
Let’s create a really simple first application that just says hello to the current Facebook user. Here’s the code for the Hello Facebook! application:
require_login();
/* now we will say:
Hello USER_NAME! Welcome to my first application! */
?>
Hello < fb:name uid='' useyou='false' possessive='true' />! Welcome to my first application!
Debug:" . print_r($facebook,true) . "";
?>
So what happens when a user hits the Canvas Page URL (from the example it would be: http://apps.facebook.com/makebeta/)? The require_login() call will produce a screen like this for the user:
Facebook Require Login Screen
If you change require_login() to require_add() the user will get a page that looks like this:
Facebook Require Add Screen
After the user logs into or adds the application they will get the canvas page with the “Hello…” text. It should look something like this:
Facebook Hello Screen
Facebook Markup Language – FBML
Facebook has provided a bunch of built in tags that will render dynamic data inside your application. All you have to do is include the tags with the correct parameters. In the example above the fb:name tag is used to generate the user’s name on the canvas page. fb:name has a couple of parameters, one of which is uid. In the example above we set uid = $fb_user which is the unique ID of the current user. There are lots of FBML tags you can use, check them all out at: developers.facebook.com/documentation.php?doc=fbml
Facebook API REST-based Interface
The Facebook Client Library provides you with an easy to use wrapper for the Facebook API REST interface. All of the API calls are available under the $facebook->api_client object (after you initiate the $facebook object). Many of the calls will require that the user has either added or logged into the application. Here’s an example call that would retrieve the user’s About Me text from their profile:
$fb_user = $facebook->user;
$about = $facebook->api_client->users_getInfo($fb_user,'about_me');
There are a number of API calls, and a list of them can be found here:
developers.facebook.com/documentation.php
Resources and Further Reading
These are very helpful pieces of information that I highly recommend reading before you get too far into making your Facebook application.
* Basic Facebook Application Architecture
* How URLs Are Handled Within An Application
* Understanding Your Callback Page
And of course the official documentation / developer site:
* Facebook Developers Site
* Facebook Developers Wiki
Other Facebook tutorials and how-to articles:
* Tucows – Getting Started With Facebook Application Development
* 10 Things That Would Have Been Nice to Know When Starting My Facebook Application
* Developing with the Facebook Platform and PHP
How To Create An API? (10 Tutorials)
Behind almost every successful web application, there is an easy-to-use & feature-rich API as they simply help the main application to spread into others & reached by more users.
Also, an API-enabled application can be easily developed further using the API itself.
In order to create an API for your web application, here are 10 tutorials to get you started. But before that, you may want to checkout the video: How To Design A Good API and Why it Matters by Google.
PHP
Create a REST API with PHP
Create REST API With PHP
A very detailed yet easy-to-implement tutorial on creating a REST API with PHP.
And, there is a follow-up article: "Making RESTful Requests in PHP" by the same author which can guide you as well.
How to Add an API to your Web Service (PHP)
Create API PHP
A detailed tutorial which describes the concepts like REST, SOAP & creates an API step-by-step with PHP.
Implement a Rest API with the Zend Framework
API With Zend
This example utilizes controllers in an MVC style application. Most of the stuff is handled by an instance of Zend_Rest_Server so it shows implementing to our service.
Creating a Simple REST API With VB, PHP and MySQL
REST API With PHP,MySQL & VBScript
This article covers both creating an API with PHP where the data is stored in a MySQL database & reaching to the API with a VBScript file.
Create Your Own Custom API (PHP)
Create A Custom API
The tutorial describes a PHP API returning XML data in 6 steps:
* Create Your Own Custom API
* Developing the basic API layout
* The Client
* The Server
* The Server Class
* The "Test" Step
Towards RESTful PHP – 5 Basic Tips
PHP API Tips
Ok, this is not a tutorial but includes very handy tips that can be used when creating a REST API with PHP for the security & ease of usage of the API.
Rails
Creating Open Web APIs: Exploring REST and WOA in Rails 2.0
Creating Open Web APIs
As Rails automatically offers URL addressable resources for all the data in a Rails web application, every Rails application already has a ready-to-go RESTful API". The tutorial explains how to use it in detail.
How to Make an API for a Rails App?
Creating An API For Rails Application
The article describes the 2 options for creating an API:
* HTTP Basic Auth
* Using API key
and provides example codes o get you started.
Putting REST on Rails
Ruby on Rails And Rest
The tutorial uses the RESTful Rails Controller & creates a simple RESTful Rails application with a full test suite and HTTP method dispatching.
ASP.NET
Create REST API using ASP.NET MVC (JSON & XML)
Create API With Asp.Net
A solid start to creating your own REST API with ASP.NET MVC.
Considering, depending on the type of the request you may want to sendXML or JSON data, the tutorial provides a class which can return both.
Also, an API-enabled application can be easily developed further using the API itself.
In order to create an API for your web application, here are 10 tutorials to get you started. But before that, you may want to checkout the video: How To Design A Good API and Why it Matters by Google.
PHP
Create a REST API with PHP
Create REST API With PHP
A very detailed yet easy-to-implement tutorial on creating a REST API with PHP.
And, there is a follow-up article: "Making RESTful Requests in PHP" by the same author which can guide you as well.
How to Add an API to your Web Service (PHP)
Create API PHP
A detailed tutorial which describes the concepts like REST, SOAP & creates an API step-by-step with PHP.
Implement a Rest API with the Zend Framework
API With Zend
This example utilizes controllers in an MVC style application. Most of the stuff is handled by an instance of Zend_Rest_Server so it shows implementing to our service.
Creating a Simple REST API With VB, PHP and MySQL
REST API With PHP,MySQL & VBScript
This article covers both creating an API with PHP where the data is stored in a MySQL database & reaching to the API with a VBScript file.
Create Your Own Custom API (PHP)
Create A Custom API
The tutorial describes a PHP API returning XML data in 6 steps:
* Create Your Own Custom API
* Developing the basic API layout
* The Client
* The Server
* The Server Class
* The "Test" Step
Towards RESTful PHP – 5 Basic Tips
PHP API Tips
Ok, this is not a tutorial but includes very handy tips that can be used when creating a REST API with PHP for the security & ease of usage of the API.
Rails
Creating Open Web APIs: Exploring REST and WOA in Rails 2.0
Creating Open Web APIs
As Rails automatically offers URL addressable resources for all the data in a Rails web application, every Rails application already has a ready-to-go RESTful API". The tutorial explains how to use it in detail.
How to Make an API for a Rails App?
Creating An API For Rails Application
The article describes the 2 options for creating an API:
* HTTP Basic Auth
* Using API key
and provides example codes o get you started.
Putting REST on Rails
Ruby on Rails And Rest
The tutorial uses the RESTful Rails Controller & creates a simple RESTful Rails application with a full test suite and HTTP method dispatching.
ASP.NET
Create REST API using ASP.NET MVC (JSON & XML)
Create API With Asp.Net
A solid start to creating your own REST API with ASP.NET MVC.
Considering, depending on the type of the request you may want to sendXML or JSON data, the tutorial provides a class which can return both.
Subscribe to:
Posts (Atom)