Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6866653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:12:45+00:00 2026-05-27T03:12:45+00:00

I am following the guide here to play around with the facebook php sdk,

  • 0

I am following the guide here to play around with the facebook php sdk, but my little app doesn’t work. It keeps staying on the login page.

Here is the controller:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Facebook_connect extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form','url'));
        $this->load->library('fb_connect');
    }

    function index()
    {

    }

    function test()
    {
        $data['title'] = 'Facebook API Testing';

        $data['user_id'] = $this->fb_connect->user_id;
        if($data['user_id'])
        {
            $data['user_profile'] = $this->fb_connect->user;
        }
        if($data['user_id'])
        {
            $data['logout_url'] = $this->fb_connect->getLogoutUrl();;
        }
        else
        {
            $data['login_url'] = $this->fb_connect->getLoginUrl();
        }

        $this->template->load('template', 'facebook_connect/test', $data);
    }
}
?>

Here is the view:

<h1>php-sdk</h1>

<?php if($user_id): ?>
  <a href="<?php echo $logout_url; ?>">Logout</a>
<?php else: ?>
  <div>
    Login using OAuth 2.0 handled by the PHP SDK:
    <a href="<?php echo $login_url; ?>">Login with Facebook</a>
  </div>
<?php endif ?>

<h3>PHP Session</h3>
<pre><?php print_r($_SESSION); ?></pre>

<?php if($user_id): ?>
  <h3>Your Avata</h3>
  <img src="https://graph.facebook.com/<?php echo $user_id; ?>/picture">

  <h3>Your User Object (/me)</h3>
  <pre><?php print_r($user_profile); ?></pre>
<?php else: ?>
  <strong><em>You are not Connected.</em></strong>
<?php endif ?>

I get stuck at it and couldn’t figure out why.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:12:45+00:00Added an answer on May 27, 2026 at 3:12 am

    Use this example provided by facebook:

    https://github.com/facebook/php-sdk/blob/master/examples/example.php

    But keep your $this->load->library('fb_connect'); and make sure to add $this->fb_connect to any facebook library calls in that example.

    It works 100%. Try to just put all the code in the controller to make sure it works, then distribute as needed. Not sure what your problem is, perhaps faulty return url.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following the guide here, I have created a full-screen WPF application. But I met
I've been following the guide here: https://developers.facebook.com/docs/authentication/ Once I have the server-side flow section
I am following the Getting Started guide for wxPython. But unfortunately the first 'Hello
I'm following the guide here: http://webtempest.com/how-to-allow-image-uploads-in-rails-on-heroku/ And I am getting an error whenever I
I'm following this guide here: http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/09/16/integrating-structuremap-and-nhibernate-with-wcf.aspx And has now come to the end of
I was following the guide from here John Anderson Vim Setup to help setup
For reading local files this guide here uses the following code: function handleFileSelect(evt) {
I'm following the step by step guide here and I hit an error at
I'm following the Microsoft guide for implementing federated identities. As it doesn't state where
I followed the guide here http://www.hackido.com/2010/01/installing-git-on-server-ubuntu-or.html but I cannot find the proper way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.