This post shows you how to get the sample Facebook application working with the CodeIgniter framework. For PHP Facebook has an PHP Facebook API and it is located on github. This library gives the php developer much more intuitive access to the facebook api methods and entities.
Download Facebook PHP API ?
To Download Facebook PHP SDK (v.3.2.3) click here
To Download Facebook PHP SDK (v.4) click here
Getting Started
So, let’s get started with your first Facebook application written with CodeIgniter. By the end of it, you’ll have everything you need to create a Facebook application.
1. Download CodeIgnier Framework and Install it. if you install currently , You should see the generic message, “Welcome to CodeIgniter!” If you don’t, you’ve missed something along the way. Reinstall CodeIgniter and start over.
2. Go to Facebook.com/developers and set up a new application.
3. now download Codeigniter Facebook SDK library, to download click here
4.copy and place config and library directory in your ci app.
How do I use it?
You can load the facebook sdk like other libraries in Codeigniter , but you need to set config values in config/facebook.php , Enter your app ID and secret code there.
1 |
$this->load->library('facebook'); |
That’s it your done!.
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.
but how to make automated post to my page which is administrated by me ?
https://www.facebook.com/notes/duct-tape-marketing/automatically-add-blog-posts-to-your-facebook-fan-page-wall/119049411472553
thanx so much
Please fix Codeigniter Facebook SDK library link, is hhttps instead https 🙂
Thanks , changed:)
i followed the step i called the library after what can i do help me please
$this->load->library(‘facebook’);
Now you can access all of the facebook SDK methods , like print_r($this->facebook);
i used print_r($this->facebook); but empty screeen will come
Hey , just tested downloaded files , its just working fine , access in your browser something like : http://localhost/fb-ci/index.php/welcome/login , before this add your app keys in facebook.php file which you can find at config/facebook.php
if you still need help let me know
please tell me
you are not installed properly, if you install properly you should have access
config, facebook .php file is inserted after base_facebook.php, facebook.php,fb_ca_chain_bundle.crt
file is uploaded in libraries this is proper intalliation?
yes, correct. your are on which ci version?
now
download Codeigniter Facebook SDK library, to download click here – See
more at:
http://arjunphp.com/facebook-api-codeigniter/#sthash.TPPo2B9M.dpuf
now
download Codeigniter Facebook SDK library, to download click here – See
more at:
http://arjunphp.com/facebook-api-codeigniter/#sthash.TPPo2B9M.dpuf
sorry you give the link in instruction in 3 steps i dont know the version
try this http://arjunphp.com/wp-content/uploads/2014/05/facebook-api-sdk-codeigniter.zip
i changed but did not get output empty screen will come
access /index.php/welcome/login screen
index.php/welcome/login but i did not get output empty screen occur please tell me
please tell me g
i download your link after change ci name fb-ci
i run http://localhost/fb-ci/index.php/welcome/login
this error will come
Uncaught exception ‘Exception’ with message ‘Facebook needs the CURL PHP
extension.’ in
C:xampphtdocsfb-ciapplicationlibrariesbase_facebook.php:19
Stack trace:
#0 C:xampphtdocsfb-ciapplicationlibrariesfacebook.php(18):
require_once()
#1 C:xampphtdocsfb-cisystemcoreLoader.php(973):
include_once(‘C:xampphtdocs…’)
#2 C:xampphtdocsfb-cisystemcoreLoader.php(216):
CI_Loader->_ci_load_class(‘facebook’, NULL, NULL)
#3 C:xampphtdocsfb-ciapplicationcontrollerswelcome.php(14):
CI_Loader->library(‘facebook’)
#4 [internal function]: Welcome->login()
#5 C:xampphtdocsfb-cisystemcoreCodeIgniter.php(359):
call_user_func_array(Array, Array)
#6 C:xampphtdocsfb-ciindex.php(202):
require_once(‘C:xampphtdocs…’)
#7 {main}
thrown in C:xampphtdocsfb-ciapplicationlibrariesbase_facebook.php on line 19
please tell solution
login button is clicked after getting this error
Given URL is not allowed by the Application configuration: One or more
of the given URLs is not allowed by the App’s settings. It must match
the Website URL or Canvas URL, or the domain must be a subdomain of one
of the App’s domains
after login i got this error
in localhost it will not work
hi i try it in subdomain also not working ? what do i wrong here
in local print_r($this->facebook); get output (loading the library when using $this->load->library(‘facebook’)
server did not get output print_r($this->facebook) and $this->load->library(‘facebook’)(did not loading the library)
please tell me quick
$this->load->library(‘facebook’) library fun not load in server
how to solve this problem tell me
base_facebook.php, facebook.php file upload in libaries but i calling $this->load->library(‘facebook’)
library is not work server side but work in local machine i dont know please tell me the solution
i waiting for your answer
https://uploads.disquscdn.com/images/d0600229b611ef27bc4d84867b878da85321d7f6867d2e3415ba1568acb938b7.png
hai friends i got the output but i need user another information(email etc) where i get tell me
‘scope’ => array(’email,user_birthday,user_location,user_work_history,user_hometown,user_photos’)
but i did not get
hello how i can use user_photos in api this is my code $user_fre = $facebook->api(‘/me/photos?limit=2&type=uploaded’);
what is the response for above line?
picture
HI
I tried this one but only i got name and id
But how to get email and other information
Please reply me
To fetch email address you must have the permission to access it. To request permissions, add email to the scope as shown below –
$facebook->getLoginUrl(array(‘scope’ => ’email,read_stream’));
Hi I’ve tried that but it comes with an FB error:
Invalid Scopes: read_stream. This message is only shown to developers. Users of your app will ignore these permissions if present.
Hellow Sir ,
After trying the steps i am getting Below error ,Its giving CURL erroor
Fatal error: Uncaught exception ‘Exception’ with message ‘Facebook needs the CURL PHP extension.’ in wampwwwciprojectapplicationlibrariesbase_facebook.php on line 19
( ! ) Exception: Facebook needs the CURL PHP extension. in wampwwwciprojectapplicationlibrariesbase_facebook.php on line 19
enable CURL PHP extension in your server.
Fatal error: Uncaught exception ‘Exception’ with message ‘Facebook needs the CURL PHP extension.’ in C:xampphtdocsciapplicationlibrariesbase_facebook.php:19 Stack trace: #0 C:xampphtdocsciapplicationlibrariesfacebook.php(18): require_once() #1 C:xampphtdocscisystemcoreLoader.php(973): include_once(‘C:xampphtdocs…’) #2 C:xampphtdocscisystemcoreLoader.php(216): CI_Loader->_ci_load_class(‘facebook’, NULL, NULL) #3 C:xampphtdocsciapplicationcontrollerswelcome.php(10): CI_Loader->library(‘facebook’) #4 C:xampphtdocscisystemcoreCodeIgniter.php(308): Welcome->__construct() #5 C:xampphtdocsciindex.php(202): require_once(‘C:xampphtdocs…’) #6 {main} thrown in C:xampphtdocsciapplicationlibrariesbase_facebook.php on line 19
I tried this one but only i got
Hi Arjun,
How are you?
Can you help me in get facebook data like join groups and pages likes of login user
I am waiting for your reply….
hlo sir i download the facebook api and get the appid and secert from facebook developer
but when i run facebook api on localhost it show error
did u have must to install database before?
hello sir…
how to facebook page like using php script..