My First Facebook Application Was A Bust

Writen By Tyler Ingram on Jan 18, 2008
Facebook - Interacting with Applications via PHP

While trying to increase my web programming knowledge I was thinking to myself: What can I learn that might benefit other people? That’s when I thought about Facebook and how it supports PHP applications.

The next thing was to think of a relatively easy project that would allow me to learn the Facebook programming environment and I thought about what Facebook is to some people; Facebook is a fun stalker web application! Ok so stalking isn’t a good thing but what else do you do when you’re on Facebook? You look at your friends’ profiles to see what they have been up to right? Well the idea I came up with (as simple as it might be) was to show to the visitors (your friends) the last time you were on your profile.

Currently Facebook tells you if you’re online or if you have been online in the past 5 minutes right? Well I wanted to see if I could bump that up a notch and show people down to the minutes when you last accessed your account.  Why would I want to do that? Well if I haven’t seen someone on Facebook for a while I am curious as to the last time they were actually on their account.

Facebook (being one of the most popular Social Networking sites in the world) is actually an interesting concept when it comes to user created applications. Facebook does not host any of the user-made creations but simply ‘requests’ them from remotely (third party) hosted web servers.  This in itself is pretty efficient; I guess this is so the Facebook servers can use their resources for other things. So if you find an application being slow to respond, chances are it’s the third party server of the application that is having troubles.

Learning how Facebook allows you to add application is pretty straight forward, especially if you are already into web development using languages such as PHP, Python etc. Their developer’s area is pretty well stocked with helpful information about interfacing your scripts with Facebook and there are a few good example of creating some basic applications. They have their own Markup Language (similar to HTML), easily useable PHP classes for interacting and retrieving information, as well as their own SQL based functions to help you retrieve user information at a more advanced level.

For my project all I needed was access to a MySQL Server (check) and a web server capable of processing PHP v5 (check). The idea behind the project was that every time you access your profile, a query would store the Unix Timestamp in the database along with your Facebook uid (user id). It was pretty quick and using only about 10 lines I could create the script and have it display to the user and their visitors with ease. The downside to it though, is the way Facebook actually works in regards to the Profile page (the page which your visitors or friends get to see).

Facebook is a ‘PUSH’ environment. In simple terms, it caches everything on your profile to display it to your visitors and only updates when you physically interact with the applications. What does this mean for my first application? People would have to physically go to my application (the settings page) every time they logged into Facebook so that the timestamp would be properly recorded.

LastOn - My First Facebook Application

As you can see from the image it shows me being last on 22 hours ago. Don’t pay attention to the minutes, my math calculation seems to be a bit off. Anyway, 22 hours ago was the last time I looked at my applications settings page so that is why it seems as if I haven’t logged in, in almost 24 hours! If you know me you know I check Facebook at least hourly if not more often.

So what does this mean for me? It means my ultimate stalker application for Facebook is a bust. It seems I am unable to have my scripts act the way I want to which is a bit disappointing. My next step is to perhaps figure out another Facebook application I can create that will work the way I expect it to and which will hopefully be useful to people out there.  If you have an idea for a Facebook application I am interested to hear about it.

Posted in: Blogging| PHP| Web Development | 1,154 views

 8 Comments

  • The only thing I like about Facebook is the developer section, or more specifically, the Programming Puzzles page. I’ve done a few of them, and once I’m finished with this project for Science World, I think I’ll tackle another.

  • I’ve looked at those puzzles but I have not actually looked into doing them. Perhaps one day I will. I do like a good puzzle.

  • I do belive that others have tried to do apps like this, and other “stalker”-like applications, to see what people visited your profile for example, but that those applications wern’t allowed by Facebook policy or something.

  • I wish I know how to make applications in facebook.
    Do have a lot of ideas, but not the programming part.
    haha

  • They have a development section (its also an application for facebook) that you can check out. The have simple tutorials on how to create applications. Facebook primarily uses PHP, MySQL and Ajax. Though depending on what it is you want to create, you might not need to know all of that.

  • I am also want to develop a facebook application. Is there any tutorial available on internet.

  • George if you check out Facebooks Development site in the above link in the post they have a great little mini-tutorial section on how to develop an application for them using their API. It’s pretty roboust and easy to get the hang of. All you need to previously know is HTML and PHP.

  • Facebook is a big task to take on even if in time you can make a lot of money from it. I would try starting small with little things like guests books and what not then when getting familiar with php and mysql get the hand of the api and it will make programming easier.

Leave a Reply