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
- 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. - 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.
- Your API key: this key identifies your application to Facebook. You
- 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. - Enter a callback URL. This is the address where your application lives
on your server, or the server where the application is being hosted. - 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. - You want users to be able to put your application on their profiles, so
select “Yes” at “Can your application be added on Facebook?” - 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:
- 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. - 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. - 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). - 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.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
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.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
No comments:
Post a Comment