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 9247161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:39:47+00:00 2026-06-18T09:39:47+00:00

I am currently trying to make a login with Facebook for my website. Currently

  • 0

I am currently trying to make a login with Facebook for my website.

Currently I have just made a simple app, which should echo out the users first name, but it just redirects me to http://facebook.com/

EDIT: I here is my PHP source, of my example:

require_once 'facebook.php';
$facebook = new Facebook(array(
'appId' => '****************',
'secret' => '****************',
'cookie' => true, ));
$req_perms = "publish_stream,offline_access,user_status,email,read_stream";

$session = $facebook->getSession();

$loginUrl = $facebook->getLoginUrl(array('canvas'=>1,'fbconnect' => 0,'req_perms'=>$req_perms));
$me = null;

if (!$session) { echo "<script>top.location.href= '$loginUrl';</script>";exit;}

else{

 try {
        $uid    =   $facebook->getUser();
        $me     =   $facebook->api('/me');
     } 
 catch (FacebookApiException $e) 
   { echo $me['firstname']; exit;}
}

 ?>

EDIT: I have made a remake, to upgrade the getSession() to the getUser().

But it is still just redirecting to Facebook’s home page. Any ideas?

New source:

<?php

require_once("facebook.php");

$config = array();
$config[‘appId’] = '116624645175305';
$config[‘secret’] = 'a6b557e6d703328d0cac9db47b20ae98';
$config[‘fileUpload’] = false; // optional
$config[‘cookie’] = true;

$facebook = new Facebook($config);

$req_perms = "publish_stream,offline_access,user_status,email,read_stream";

$user = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(array('canvas'=> 1,'fbconnect' => 0,'req_perms' => $req_perms));
$user_info = null;
if (!$user) {
    echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";exit;
}else{
    try {
        $user_info = $facebook->api('/me');
    } 
    catch (FacebookApiException $e) {
        echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>"; exit;
    }
}

?>
  • 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-06-18T09:39:48+00:00Added an answer on June 18, 2026 at 9:39 am

    Facebook SDK for PHP has no method getSession();

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

Sidebar

Related Questions

i'm currently trying to make a asp.net mvc3 app. in the sample application which
I'm currently trying to make a set of conversion functions which, through one call,
im currently trying to make a simple IRC Gui Client. Im using the SmartIrc4net
I'm trying to create a simple login system that will have the forms and
I'm trying to create a website that allows users to login with their Facebook
I've been trying to make phonegap-plugin-facebook-connect cordova plugin Simple example work, and i've experienced
I am currently trying to make a login system in Flash. I tried downloading
I am trying to make a Facebook Connect web app more mobile friendly. I
I'm currently writing a PHP login script and trying to make it as secure
I am trying to make a safe, custom, user login system, but it currently

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.