I’m prototyping a Facebook app, with the CakePHP framework as described here, and I hadn’t looked at the API for a few months, and never with my current hosting provider. A few things I found out:
- The “sample code” gzip off Facebook’s SVN server has a much different layout than the one linked off the Quick Creation Guide popup. Use the latter.
- Make sure you choose the right /client directory for your hosting provider. I’m stuck with PHP4, and the directions assume you are using the PHP5 version.
- You may need to download the simplexml classes (as per this link).
- To save time you’ll want to run locally, but Facebook doesn’t allow “localhost” URLs for callbacks. So workaround it with some DNS trickery by editing your hosts file. However that only works if you’re not using FBML – if you are, then you’ll need an externally-accessible server. In that case, you’ll have to open a new public port on your router firewall and forward it to your local webserver, then update the Facebook app callback url with your (current) WAN IP address and new public port. As usual with opening ports, do so with caution!
- If you get the “server taking too long to respond error”, try hitting your localhost directly from another PC. If you get any fatal errors (which for some reason don’t show up from localhost), then that will cause the error you see. Obviously it’s not really a timeout error but a PHP one in that case; you’d think that Facebook would be able to hint that to the developer…
- Regarding CakePHP as a framework, note that vendor() has been deprecated. Use this instead in app_controller.php:
App::import('Vendor', 'facebook');
- Set CAKE_CORE_INCLUDE_PATH to some central directory so you can share one CakePHP installation among multiple apps.
Facebook folks – update your directions!