With the increasing popularity of Web 2.0 applications, today's Web has changed from an independent Web Site to an interactive Web Application. More and more Web 2.0 applications are opening up APIs, and other Web applications are welcome to be integrated to provide users with closer services. Network giants such as Google and Yahoo have already provided a wide range of APIS for Web applications to call. Facebook, however, has a proprietary approach, proposing the concept of Web Platform, boldly building itself into a Web Platform, allowing other Web applications to run directly on Facebook's Platform. Thousands of Web applications began to write applications for Facebook, so that large Facebook users can directly access their own applications, resulting in significant traffic increases. Although Chinese websites cannot directly benefit from Facebook, the integration of Web applications is the trend of the times. This article uses how to integrate a Web calculator (http://www.googlook.net/samples/calculator/Module.html) into Facebook as an example to demonstrate how to create a Facebook Application from scratch.
To create an Application running on Facebook, you must first register a Facebook user and log on to it. Then you can create a new Application:
Http://www.facebook.com/developers/editapp.php? New
Edit Application settings:
You need to fill in the following basic items:
Application Name: this is the Name of the Application listed on Facebook. Of course, you need a meaningful and easy-to-remember Name;
Support E-mail: enter your own Email address to receive some updates to Facebook;
Callback Url: fill in the Application page portal. For the Web calculator, fill in the access address "http://www.googlook.net/samples/calculator/module.html ";
Canvas page url: Set the portal address of my application on Facebook, and fill in "GWT-calculator". In the future, other users can use the address "http://developer.facebook.com/gwt-calculator”" to access my application;
For integration methods, Facebook provides fbml and IFRAME. We should first select "use iframe" as the simplest integration method.
You can also select a 16x16 image as the logo for the application. After saving the settings, we can directly access this application on Facebook. Enter the application's Facebook portal address "http://developer.facebook.com/gwt-calculator ":
If you do not have your own web site, enter http://www.sina.com.cn/test.
So far, we have integrated a web application-web calculator into Facebook. In fact, this integration method is applicable to any independent website and has nothing to do with the programming language, because users access our web application through IFRAME on the Facebook page, and its effect is the same as accessing the web application directly, in addition, the application access speed is irrelevant to the Facebook server.
Another integration method is to use Facebook's unique XML markup language, which is called fbml. If this integration method is selected, Facebook will not directly return the content of the callback URL to the user. On the contrary, the Facebook server retrieves the content of the URL, parses the <FB: XXX> tag, and presents the parsed HTML to the user.
Regardless of the integration method, we can use the rest API provided by Facebook to interact with the Facebook server to provide users with specific services based on user information. Facebook provides encapsulated libraries for common programming languages such as Java, PHP, And. net. The API for accessing Facebook using Java will be discussed next time.