Took a quick look at http://wiki.developers.facebook.com/index.php/JavaScript_Client_Library and found a few obfuscations. To get started, you need to do these things (described a little too briefly in the link above).
- Register for an application key at http://indiana.facebook.com/developers/editapp.php?new (Don't hit enter yet)
- Cllick the "Optional Fields" drop down and
- Provide a callback URL (that is, the full URL of your HTML page containing the Facebook JavaScript application).
- Choose "IFrame" as the canvas page URL.
PHP
Also took a quick tour of the PHP examples ("footprints" and some hello-world type stuff). Looks like the instructions for setting up the JS example assumed you were familiar with doing things the PHP way.
For footprints, you will need a web server (apache), PHP, and MySQL. Get, install, and start these in the usual ways. Hints: for Macs, get the nice disk image from MySQL. Also, read the PHP installation instructions before installing Apache, since PHP will require some non-default configuration options (particularly DSO support).
The web server provides the callback URL as well ("http://your.host.name/footprints"), which will need to be on a world accessible Apache (or other) server. Dump your application in htdocs/footprints and make sure paths are correct (index.php needs to point correctly to facebook.php). Note also that apps.facebook.com/footprints will be taken, so make a different name. The facebook app name does not have to match your callback app's name.
Create the MySQL database. The footprints PHP scripts don't do this for you.
- Edit config.php. You will need the root password for your db.
- From the command line, log into your db with /usr/local/mysql/bin/mysql -u root -p and provide the root password at the prompt. You will then need to create and switch to the footprints database.
- mysql> CREATE DATABASE footprints;
- mysql> USE footprints
- mysql>CREATE TABLE `footprints` ( `from` int(11) NOT NULL default '0', `to` int(11) NOT NULL default '0', `time` int(11) NOT NULL default '0', KEY `from` (`from`), KEY `to` (`to`) );
When it is working, this little application allows you to step on your friends. It gives you a little text area for typing names that will be autocompleted as you type. Note this must run inside Facebook, unlike the previous example.
When setting up your PHP app, you'll notice you can choose between FBML and IFrames. FBML will (as you might have guessed) a nice FaceBook styled application and some extra goodies. The IFrame option will produce a pretty bare bones footprint application, but obviously you have more power to customize the styles.
Hosting Your Services
Here are some instructions on using Amazon Web Services to host your application.
http://developer.amazonwebservices.com/connect/entry.jspa?entryID=1044
No comments:
Post a Comment