Anda di halaman 1dari 36

Facebookoriginal.

com For Applications and Resources



Copyright March 2009 Lee Holdsworth


Your First Facebook
Application
&
How to Make Money
While You Sleep



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

Overview
Welcome to your first facebook application and how to make money while you
sleep.

Firstly, I came about writing this book due to the fact that a number of my
clients from facebookoriginal.com kept asking how to make their own
applications and how could they make money from the massive FREE market
that facebook.com has to offer. So, I decided to put together the basic
framework and a step by step guide that anyone with basic knowledge could
understand.

Whilst I appreciate the difficulties of keeping up with facebook at the time of
writing this book (March 2009) facebook had just updated their systems and
many users past and present found difficulties in relating to the new formats
etc.

Here we are going to take you step by step in how to create an application and
have it making money for you even while you are asleep.

If you have any queries please simply pop along to www.facebookoriginal.com
and post any questions in the forums.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

Index
Section Page
1. Tools that you will need.
2. Things you need to do!
3. Setting up the basics of an Application
4. Set Up Your Server
5. Set up Mysql Database
6. A confidence builder
7. Stepping up to the mark
8. Creating a Money Making Application
9. Promoting the Application
10. Make Money While You Sleep















Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth










1. Tools That You Need
Now that you have decided that you want to make some money you will need the tools of
the trade.

The tools that I am about to list are the exact tools that I use when creating an application. I
am more than aware that there are far better programmes out there for manipulating and
editing code I have no intention of spending thousands of dollars on programmes that are
either far too expensive or that complicated you need to have done a degree in computing
to use. For these reasons I have chosen these tools due to their simplicity and the cost
(some of which are free).

1. Ftp Programme

You need an ftp programme that allows you to easily upload, download and easily
edit your files.

What is and what does ftp mean?

FTP means File Transfer Protocol, it is used to send larger packets of data than the
traditional TCP/IP protocol. This is usually used when you download programs or
documents from the internet.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth


Basically, who cares what it means we need one to upload our files to the server that
stores our files and where our files are served to the users of the application we are
about to write.

I personally use Coffeecup.com FTP. I first started using the free version until I made
some money then bought the licensed version. At the time of writing the licensed
version is $34. However you can get the free version from
http://www.coffeecup.com/free-ftp/

Here are the features of the program and the features that you will be using during
the construction of you brand new application.
Some Features of Direct FTP
Edit Files From Your Server
Bookmark folders and go to them with just one click!
Edit HTML and Text right on the Server!
Full drag-and-drop FTP upload and download
One-click browser testing that lets you test before you save or upload
Support for a multitude of secure file transfer connections
Code highlighting for HTML, CSS, PHP, JavaScript, and more
Upload/download entire folders at once
Combo bookmarking
Preview images from the server
Built-in ZIP archiving
Multiple FTP server profile support
Code highlighting, theme sharing, and code snippet support
HTML code completion
Helpful features like the Link Wizard, Image Wizard, and Font Wizard

So go start downloading that while we continue with what other tools are required.
2. A Logo or Graphics Creator

Again, I use the very basic and easiest to use software as I am absolutely no artist. I
would however use something that creates pretty decent graphics as the graphics
determine what you application looks like. Some applications do not require a lot of


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

graphical elements and others do. With me being a lazy programmer, I like to use
software that is very easy and allows me to create graphics in less than ten minutes.

I hear many programmers moaning on about Photoshop this and Photoshop that.
Well I tried it and it has far too many buttons to click to get the desired outcome. All
I want is a simple programme to create a logo or a banner.

The best one I have found is The Logo Creator by Laughing bird software. Logo
Creator again they have some trial software so you dont have to buy anything yet.
The only thing the trial doesnt do is save your work.

Give it a try for yourself.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

2. Things You Need to do!
Now that you have the basic tools needed you need to set a few things up on Facebook, and
get a hosting account!
1. Facebook

So you have heard of facebook right! You need to go to facebook.com and register a
user account to start with.

So when you first visit facebook you will be presented with the following page.




Simply fill in the fields with your correct information and you will have created your
own facebook.com account. Welcome to spam city. Your life is not yours anymore.

You are now owned by facebook.com and everyone from past and present life will
be inviting you to join quizzes and take part in surveys and join meaningless groups.

Wrong!!! This is where your customers err!!! Oops!! I mean users come from.

You will be presented with an option to invite people from your various address
books. For example, your AOL accounts, your msn account etc.

Invite them all!!! Tell everyone you have moved into the 21
st
Century and become
another user on the forever growing website.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

This is what the invite page looks like.




Insert your email and your password for your email account and boom! You have
200 friends in no time.

The whole object of the friends which is your users to your applications are the
traffic that you need to make your application successful.

In a recent example which I did myself I set up an application called
http://apps.facebook.com/riddlesforme and I only invited 15 friends. I left it at that
and got on with my next project.

Within approximately a week I returned to the application to see how it was getting
on and found over 200 people were actively using the application. This is without
any promotion other than inviting 15 friends. I will go into the Viral Effect later in
the book.

The viral effect of your applications is like the life line and can be a massive source of
income over a period of time.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth


2. Facebook Developers

Now you need a facebook developers account. Dont be scared you are starting to
look like a developer.

So how do you go about getting a developers account. It is very easy.

Just visit http://www.facebook.com/developers/ and you will be presented with this
screen.



Note the button in the top right corner that says +Set Up New Application.

You will be presented with a discussion board where all the wannabe developers
discuss what they do and dont like, the apps they are selling and you will often find
answer to your queries or questions in the forum. Believe me, you will run into
errors and you will not be the only person who has had that error. Generally, you will
find the forums pretty informative.

Ignore the forums for now as you are now about to set up your first ever application.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

3.Setting up the Basics of an Application

1. Set it up!
Now you did take note of the +Set up application button before didnt you.
Hmm didnt think so. Dont rush through the book! Read it all and follow it step
by step. It will prevent any silly errors when you come to run your application.

Ok now you see the +Set up New Application button in the top right.

Click it!

This will then present you with a scary screen. Scary! Why? You ask yourself well
the main reason being is because you being you are now being asked a question
from the developers application and you dont know what to put.
Your immediate thoughts are Hmmm I will put in Mob Wars and make an RPG
game and make $30,000 per month. Well dont! You are being silly.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

Applications like Mob Wars have been around for years and have thousands if
not millions of users. Your server would have to be capable of dealing with
millions of queries per minute to cope with all that traffic.

Ok! So now you are presented with the following screen.



In the Application Name insert your application name. For the purpose of this
exercise call it My Pet. If this is not suitable we can change it later.

Now go read the terms of services which are highlighted in blue. Take note of the
various dos and donts. These are the rules that your application must abide by.
If you dont abide by them then Facebook will terminate your application
without any notice. If you feel aggrieved by their termination and you complain
stating that they gave you no notice. You are wrong! By you ticking the Agree box
means you were given notice of the rules and if you break them thats it. Your
application with all the hard work you put into it will be terminated.

So read the rules!!!! And make sure you understand them. If you are not sure if
your application will cause any issue then dont even bother with it.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

So, now we have input the name of our new application and called it My Pet.
Now that you have read the rules go and click on the agree button and click
submit.
Wow! Can you feel the rush.... oh no.... what is this that I have been presented
with now I hear you cry!
This is what you will see:


Just to quickly run through each section. I have highlighted each part with a
letter for ease of reference.
A This should be self explanatory. The Application name is that which appears
in the Directory and on the Title of the About page.
B The application Id. This is a unique identifier within facebook for your
application. So if someone wants to view your application page they would visit
http://www.facebook.com/apps/application.php?id=60092974019 where the
60092975019 is the unique application identity.
C API Key this is very important as you need this in your application to interact
with facebook. When your application sends a request for information on the
user for example this key allows you access.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

D Secret again this is very important. Facebook verifies your application using
this key. Do not share this with anyone.
E You should enter a brief description about your application. The main reason
being that if someone should visit your about page then they can find out all
about your application. This you can view as your mini sales pitch. So make it a
good description.
F & G These are the graphical elements that are shown in your about page and
as an icon when someone installs your App. It is more professional that you
upload these prior to issuing emails or invites to people as it simply looks better.
If you dont have an icon it shows nothing. Now you want your application to be
added by everyone so make it look nice. This is where the Logo creator we
mentioned before comes in handy. You only have a small space so make the logo
and the icon as predominant as possible and as bright as possible. Make it
STAND OUT.

3. Now Take Some Details

You will need these details for later so make a note of them. I normally copy
and paste them to a text file and save them on my desktop.

Application Id No:
Api Key
Secret Key

Keep them handy for when we start actually creating something.

4. Cavas Page and Call Back Page

You will see from the menu on the left you have some choices or options. One of
them is the Canvas page.

Click the Canvas Page button.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

Once you have clicked the Canvas page button you are again presented with
some confusing questions.

The screen shot is as follows:

You will see at the top of the page Required URL and Callback URL. When I first
started I remember thinking what the hell are these all about.

Well to explain in the simplest method possible.
Canvas Page URL
I generally refer this in my scripts or applications as $appCanvasUrl this is where I
set the string so that i dont have to keep typing it in all the time. For example:

$appCanvasUrl = http://apps.facebook.com/mypetscript/



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

The Canvas page is the name of the page on facebook. So if you typed in
http://apps.facebook.com/mypetscript/ you would be directed to facebook and
the script will load inside facebook.
Canvas Call Back URL
This is the name of where you have uploaded your files to e.g. your server and
again I set a string so that I dont have to type it in all the time. For example:

$appCallBackUrl = 'http://www.yourdomain.com/mypetscript/';
I do this just because I am lazy. It is also easier to modify later.
The Canvas Call Back URL is the location of where you have stored your files.
You server address http://www.yourdomain.com/mypetscript/

A point to note here is that facebook reacts differently to applications when the
Call back Url is http://youdomain.com to that when it is
http://www.yourdomain.com so make sure you put the correct one in.

The remainder of the settings
Just leave these all set as they are for now.
CLICK SAVE.
The save button is located at the bottom of the page.




Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

4.Your Server
Now you have your application ready on facebook. You have told facebook you
intend to start an application. You have advised facebook of your Canvas now all
you need is the facebook client files and a server.

1. Obtain the Client Library

The Client Library is just a posh name for a bunch of files to make your application
work on your server and to enable communication between your server and
facebook.

So once you clicked save after you input the canvas name and the callback url you
will have been diverted to a summary page where there is all sorts of details about
your application.

The top of the page looks like this:



Scroll down to the bottom of the page where you will see the Client Library. I have
highlighted it in red so you know where to click.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth



Click that and download the files. You will need to extract them. Once they have
downloaded which only takes about 20 seconds, double click it and extract the files.

You will be presented with a folder called facebook-platform. It contains two
folders. One is called footprints and the other is called php. For now we will
concentrate on the php folder.

Inside the php folder there is another folder and three files. There is a folder called
json wrapper and three files called facebook.php, facebook_desktop.php and
facebookapi_php5_restlib.php. These are required by your application and are a
must for it to function and interact with facebook.

2. Obtain a server

If you dont already have a server you will need one. You can get them very cheap
these days. I dont use them myself but a lot of clients use Hostgator. I am not sure
how much its costs as they always have offers on. I believe they are running an ad
campaign on $4.95 per month at present.

We can also offer hosting on facebookoringal.com for facebook applications at $4.50
per month. This is quite handy if you are starting off because we can help you from
the server side if youre stuck!



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

When looking for a host (the name of the people you get your server from ) you
need to make sure you get php5 and at least one (preferably as many as you can get)
Mysql database. These elements are essential in this day and age of programming.

So now you have a server set up you will probably have to wait a day or so for your
domain name to propagate. This again is a posh word to tell you that it takes ages to
tell all the computers in the world that you now have a website and a domain name.

You normally receive an email immediately after setting up a server which will
contain some connection details in the form of an IP address (a bunch of numbers
that look like this http://123.42.12.42:2080). This is simply a number that tells the
world where your server is. The 2080 on the end could be a port connection in to
your admin or control panel depending upon your server settings.

If you are using Coffecup Ftp as detailed in the section tools you need. Now is the
time to open it up.

3. Connecting to your Server

If you are using the coffeecup ftp then open the programme and then click on
servers in the top left corner. You will be presented with a scary box which asks for
some more details. These details are essential to connect your computer that you
are sitting at to the server located anywhere in the world. This will enable you to
send the files for your application to the server in a matter of minutes.

The connection details should all be in your email from the host.

If you do not have your connection details within 24 hours I suggest you contact your
Host (e.g. me or Hostgator) and give them a right ear full. Tell them time is money!!!

Sometimes the servers are setup pretty quickly and other times it does take 48
hours. Unfortunately, this is life and you will have to put up with it.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth



The connection box looks something like this:



In the nickname section you can enter anything you like. For this example you can
enter MyPetSite.

In the Server: section you can either enter the IP address or the domain name. So
you can either enter the bunch of numbers in your email which on occasion gives
you instant access if your domain name hasnt propagated. The IP input would look
something like 123.12.12.12 do not put http or anything else in the box.

The user name and password will be that which is supplied to from the host.
Generally your username will be something resembling your domain name. So if
your domain name is www.mypetsiteapplication.com your user name might look like
mypetsi and your password will be something horrendous like 345%^f%. To be
honest the more horrendous your password the harder it is to crack so dont change
it to anything like you birthday or your dogs name.

Ok now for the big test. If everything has gone well click connect. You will probably
be asked to save the settings so click save. This will prevent you inputting the
information every time you login.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

If all is well you should now see something like this screen.



If you do see this screen then all is well and you have made a connection to your
server.

The files on here act very much like the folders etc on your desktop. The files for
your application need to be stored in the public_html folder.

So double click the public_html folder and the folder will open showing you another
folder marked cgi-bin. Ignore the cgi-bin.

Now we are going to have a quick look at what each element of the ftp program
does and how it can be useful to us.





Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth



Just a quick guide to what each section is on the ftp program.

A Is the folders directory of your computer. If you wish to upload a folder to your
server simply click on it in box A and then click upload. If you want to upload just the
contents of a folder from A then double click the folder and highlight all the contents
and then click upload.

B Is the server side. This is the contents of your server which is a million miles away
and you have easy access to it via your computer. Again you can open and close files
in this section. If you want to download a file just click the file and then click
download. If you want to edit the file which is the good part about the Coffecup Ftp
programme you simply click edit. If you do click edit then box C comes in to play.

C Is the edit window. This is the brilliant part about coffeecup. When you edit a file it
has its own html editor embedded in it. You can preview images from you server also
in this window. If you click Ftp Activity you can see the progress of any files being
uploaded to your server or from your server to your computer.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth



The edit window appears like this:



As you can see the editor numbers the lines which is ideal for when you make
mistakes and your server throws out errors. This enables you to locate and quickly fix
any mistakes that you have made.

You have probably seen the errors when you try to access some pages on the
internet where is says something like parse error on line 174 of plank.php
unexpected ;. This basically means that on line 174 of plank.php you have a ;
where you shouldnt. So then you go to the file, download it and edit out the ; and
then resave it back to the server.

So let summarise:

a) We have the tools we need
b) We setup a facebook account
c) We setup a facebook developers account and told them about the application
d) We setup the server and have a connection to the server

We now need to set up a database where we can store the information for our
application. The database is also hosted on your server but you need to access it
through your control panel.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

5.Setup Mysql Database

We are nearly there with the setup of the application. Just one last thing to do
before we start messing about with the files is set up a database.

To do this you need to go to your control panel on your host. The location of your
control panel generally is http://yourdomain.com/controlpanel if it is not there then
you will need to consult your email that you received from your host.

You will be prompted for your user name and a password upon attempting to access
the control panel. We discussed what they looked like when attempting to set up the
connection to the server using the ftp program.

Your control panel will look something like;



You need to click on the MySQL Databases icon to take you to the database wizard.

You need to look for the create new database block.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth



Insert the name of your database and click create. For example I would insert the
word pet.

NOTE: If you are on a shared server your database name is likely not going to be
pet but the server will rename it to yourdomain_pet. This is not to be confused
with your domain name. The element where I have written yourdomain will likely be
your user name to access the server e.g. mypetsi_pet

Once the database name is created you must create a user and grant the access
permissions to use the database.

Look for this or something similar on your Database page.



Simply enter the username and a password. So for example enter the user name
dave as the user of the database. Again if you are on a shared server your user
name will not be that which you entered but something along the lines of
mypetsi_dave Give mypetsi_dave a password for example 123abc098 and click
create.

Now you need to grant access to the new user mypetsi_dave to your new
database mypetsi_pet.

You will see a drop down list as follows



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth


Click the drop down menu and select mypetsi_dave and then click the drop down
menu and click mypetsi_pet. Do this even if they are on display in the box without
you clicking on them. This ensures you have selected both the user and which
database they have access to. Also select the All button and then click Add user to
database.

You now have a user with access to the database which you have created.

So when you see a script that ask for the following information you know what to
give them:


// Database Settings
$dbhost = '';
$dbuser = '';
$dbpass = '';
$dbname = '';

From the details you just created your settings would be

$dbhost =; localhost; This is because its on your server.
$dbuser = 'mypetsi_dave';
$dbpass = '123abc098';
$dbname = 'mypetsi_pet';


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

So now you have set up the database but you have no data stored in it or any tables.

The difference between a table and data is simply that the table is like a shelf system
in a library and the data is the books stored on the shelves.

So using the library example if you are looking for data (books) that contain the word
bible then you would look on the shelf that has a bookname (table) of bible.

Now we need to put all this together and create a database with tables and a
program that can access the database. Once the program has access to this
information it then needs to do something with it and display some content.

So just as a confidence builder we will use the example provided by facebook which
we downloaded earlier. If you didnt go back to the section 4 entitled Your Server
and download the files.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

6.A Confidence Builder
Let us put it all together using the facebook application to boost your confidence.

So, we already have the ftp programme open and displaying the cgi bin. If not then a
quick recap Open the ftp program, click servers, click the name of your server then
click connect, click the folder public_html.
You should now see a folder marked cgi_bin.
If you do, then continue with this example. On the ftp program you need to locate
where you downloaded the facebook files. So this is no different to browsing you
desktop or your mydocuments folder. You are looking for the folder called
facebook-platform. If you see facebook-platform again then double click that
until you see two folders. One marked php and the other footprints.

Highlight both of them an upload them to your server. This will take approximately
ten minutes to upload both sets of files.

Now while that is up loading you need to change the Canvas Call Back url on the
facebook developers site. So they know you are about to redirect your application to
a new folder.

So revisit http://www.facebook.com/developers/ and click your application under
the heading My Applications. Then click edit settings as shown:



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth


Then click on the Canvas page button on the left then change your Canvas Callback
URL to your hostname and then the folder /footprints/.
The canvas url should look something like this:
http://yourdomain.com/footprints/
Click save!
Now go back to your ftp programme. You need to insert your database details into
the config.php file. This is where we test out your editing skills.

Assuming everything got uploaded ok! Double Click on the folder named
footprints. You will be presented with 4 files; config.php, lib.php, index.php and a
README file.
Single click the config.php file so that it is highlighted, then click the edit button on
the ftp program at the top. Your ftp program will now load this file into the editor
which was highlight as section C previously in this book.




Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

You will see this file in your editor:

<?php

// Get these from http://developers.facebook.com
$api_key = 'YOUR_API_KEY';
$secret = 'YOUR_SECRET';
/* While you're there, you'll also want to set up your callback url to the url
* of the directory that contains Footprints' index.php, and you can set the
* framed page URL to whatever you want. You should also swap the references
* in the code from http://apps.facebook.com/footprints/ to your framed page URL.
*/

// The IP address of your database
$db_ip = '10.0.0.0';

$db_user = 'root';
$db_pass = 'YOUR_DB_PASSWORD';

// the name of the database that you create for footprints.
$db_name = 'footprints';

/* create this table on the database:
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`)
)
*/

Let us take this section by section. Firstly, you need to enter your API and Secret Key
that you obtained from facebook earlier. These need to be inserted where
highlighted in red:

// Get these from http://developers.facebook.com


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

$api_key = 'YOUR_API_KEY';
$secret = 'YOUR_SECRET';

Now you need to enter your database details that you created earlier. For the sake of
what it is we will use the database that you created for pets. Where $db_ip this is the
same as $dbhost;

// The IP address of your database
$db_ip = '10.0.0.0'; This will become $db_ip = localhost;

$db_user = 'root'; This will become $db_user = mypetsi_dave;
$db_pass = 'YOUR_DB_PASSWORD'; This will become = $db_pass = 123abc098;

// the name of the database that you create for footprints.
$db_name = 'footprints'; This will become $db_name = mypetsi_pet;

The following section requires you create the tables for your database for this small
script.
/* create this table on the database:
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`)
)
*/

To do this you need to revert back to your controlpanel and use myphpadmin. So, go
back to section 5 and gain access to your controlpanel then click mysql databases
again. Right at the bottom of the page you will see:




Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

Click phpMyAdmin. This will open up a new window and present you with the
phpMyAdmin control panel. In this you will see a drop down menu and a list of your
databases on the left of the screen.

Click your mypetsi_pet database. Click the SQL button as shown below.



You will then be presented with the option to Run SQL query as shown. You need to
copy and paste the database structure from the config.php file into this box. It should
look something like this:



Then click go!

You have now inserted your first table into a database.

Now your database is ready for some action from the files on your server.

But first you must save the config.php file with your edited settings back to your
server.


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

Any second now you are about to find out the power of facebook and all that is and
all that was.

Now enter the url of your application. E.g. http://apps.facebook.com/mypetscript/

You will be asked to authorise the application. Click authorise or yes or confirm
whichever one shows up. Yipeeeee you have your first application running.

You should see this:


Now hopefully, by the time you have done all this some of your friends will have
accepted your friend invites from earlier. I would be very surprised if you have no
friends by now.

So type one of your friends names who are on facebook and then click the Step
button to find out what facebook is like on a regular basis.

Yes.

Yes it is true.

No seriously its amazing!

Oh no dont tell me .....




Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

It didnt work did it!

Welcome to developing applications for facebook.

Once you clicked step your results were this werent they:


Well this wasnt meant to happen but it does and often with facebook. They are
forever making improvements and changes to their system and frameworks and you
have to adapt to suit.

So to fix these errors lets look at the problems one by one.

Firstly, Warning Missing Argument 3 for FacebookRestclient..., called in
/home/domain/public_html/footprints/lib.php on line 52. So go to your ftp program
editor and have a look at line 52 of lib.php. Once you are at your ftp program click
the footprints folder if it is not already open and click the lib.php file once and then
click edit.

Line 52 looks like this:

// Send notification
// Notice the use of reference '&'
$result = & $facebook->api_client->notifications_send($to, ' stepped on you. ' .
'<a href="http://apps.facebook.com/footprints/">See all your Footprints</a>.');

Apart from the fact that the canvas application does not point to the correct location
there are only 2 arguments called in the notifications_send. One argument
(arguments are small bits of a bigger bit) is $to, and the other is stepped on you. .'<a
href=http://apps.facebook.com/footprints/</a>. So to correct the error we need to
add a 3
rd
argument by adding a comma after </a>. and inserting a string which is
represented with a dollar sign. The correct format should now look like this:


Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

$result = & $facebook->api_client->notifications_send($to, ' stepped on you. ' .
'<a href="http://apps.facebook.com/footprints/">See all your Footprints</a>.',
$anyoldrubbish);

It doesnt really matter what the string was. We just needed to complete the
argument. The facebook client required 3 arguments so we made one up to complete
the 3
rd
. Whilst editing this file I would check all the references to
http://apps.facebook.com/footprints/ and change them to point at your application
http://apps.facebook.com/mypetscript/


The second error was :

Fatal error: Call to undefined method FacebookRestClient::feed_publishActionOfUser() in
/home/virginu/public_html/footprints/lib.php on line 58

So again we read through the lib.php file to line 58 and find the following line:

$facebook->api_client->feed_publishActionOfUser($feed_title, $feed_body);

The method that this is using to call the API is feed_publishActionOfUser. Now this
is where the developer forums come in handy. If you do a search from
feed_publishActionOfUser you will find that facebook changed this along with their
new look. Facebook have a habit of not telling anyone. This function
feed_publishActionOfUser changed to feed_publishUserAction

We therefore need to change the line to read as follows:

$facebook->api_client-> feed_publishUserAction ($feed_title, $feed_body);

Ok now save the file back to your site by click save and then remote.

Give it a moment or two to upload and then revisit your brand new application.

http://apps.facebook.com/mypetscript/

Hey presto! How exciting It now works.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

I do not kid you when I say that errors like this occur on a regular basis. So when an
error occurs you need to break down the cause of the error then search the
developer forums for a related error. Normally someone else has already fixed the
problem on one of their applications and has advised one of the many millions of
users of the fix.



Facebookoriginal.com For Applications and Resources

Copyright March 2009 Lee Holdsworth

7. Stepping up to the Mark


Now that we know we can work a FTP Program, Connect to and create a Database,
Communicate with Facebooks API, we now can look at creating the next killer application.

Here we are going to talk you through each step of building the next killer application and
what functions are readily available on facebook for us to exploit as a money making tool.

Anda mungkin juga menyukai