facebook auth dialog

The other day I noticed the still recent Facebook Software Development Kit (SDK) for PHP. You can find it here.

Simply put, an SDK allows developers to work faster by making goals easier to meet. This SDK is so straightforward that anyone can use it to build a small script to pull visitor data from Facebook.

Imagine that you want to know who visits your website and what pages they open. Later, you may want to get more data from them, location, likes, interests or anything else from Facebook. The example showed on the SDK github page is easy enough to change and achieve this. I did just that as an example, the code is at the end of this post.

If you use it, in the end you get a text file with lines that look like this:

Tue, 09 Oct 2012 06:31:00 +0100;Bruno Amaral;/how-this-blog-is-going-to-work/comment-page-1/

It starts with a timestamp, shows you the name of the person and the page that person was browsing. It could also give you the visitor’s facebook ID, facebook profile, etc.

The caveat here is that for you to get this information, that person must first authorize access of your Facebook Application.

When was the last time you authorized a Facebook App?

Before you ask: This blog will not run any of the code below or collect information from your Facebook account.