first of all, you need download facebook PHP Client Libraries. Extract package to you work path. open the directory, there are two sub-directory, PHP directory is libraries, you need use it to develop application. and a example directory called foodpoints. Open PHP directory, creating two PHP files – index.php and config.php.
In config.php:
<?php $api_key = '[API_KEY]';&amp;nbsp; // your apps api key $secret&amp;nbsp; = '[SECRET_KEY]'; // your apps secret key $backurl="http://liduan.com/fb/start";&amp;nbsp; your call back web url ?>
In index.php:
<?php
include_once 'facebook.php';
include_once 'config.php';
$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$user = $facebook->require_login(); // check user is login
try{
if(!$facebook->api_client->users_isAppAdded()){
$facebook->redirect($facebook->get_add_url()); // check user is add this apps
}
}catch(Exception $ex){
$facebook->set_user(null,null);
$facebook->redirect($backurl);
}
// main
echo "<p>Hellow</p>";
echo "<p>world</p>";
echo "<p>this is developed by <a href='http://liduan.com'>liduan.com</a></p>";
?>
finish coding, upload whole php directory to web space that must support PHP5 and make sure public can access it. example http://liduan.com/fb/start
Next, adding apps to facebook, open http://developers.facebook.com, click ‘Get Start’ -> “Add Facebook Developer Application” -> “Setup New Application” you will see a form of add new application. there are some very important options you must fill it.
submit form, you will find your api key and secret key. put them to you config.php and upload again. Now. open your call back url, and follow by facebook guide and add this app to your facebook account. you will see “hello world”.
Comments (11)
[...] first of all, you need download facebook PHP Client Libraries. Extract package to you work path. development a “hello world”application with facebook api [...]
how to use fbml
Wow! Thank you very much!
I always wanted to write in my site something like that. Can I take part of your post to my site?
Of course, I will add backlink?
Regards, Timur I.
yo, http://www.an-lar.com great name for site)))
yo, http://www.an-lar.com great name for site)))
————————
ads: http://potet.ru/
Hello webmaster,
I would like to share with you a link, write to alarroste@mail.ru
Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru
I dont usually comment, but after reading through so much info I had to say thanks
beautiiful blog merciiiiii
Wrote a bit on my experiences, especially with the viral features @ http://aleatory.clientsideweb.net/2009/07/05/step-by-step-guide-to-creating-a-first-facebook-app/
I found this information very interesting and I am looking forward to more posts!