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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:08:26+00:00 2026-05-31T13:08:26+00:00

I followed this video tutorial but i am stuck.When i click on the login

  • 0

I followed this video tutorial but i am stuck.When i click on the login link the browser keeps loading and then nothing happens and still the login page is in front of me.It always return 0 in $user_id.It showed me the facebook authentication page 1 to 2 times previously and i clicked ‘allow’ but now nothing is happening.One more thing , when i click the login link the browser url changes from

“http://localhost/php/fbdata.php”

to

“http://localhost/php/fbdata.php?state=e1d5ccf919c6a9d3325200596c12b447&code=AQDg8hE1GuKQ6eq9nGeLV8BIK8EjeIuY8Drf6g0FwAWAjGkvFi70EoNquPmoYsk2PxKpcfxVWYqNgVxU7rRQ-xBxcZXziH5n9IXNNl1KKzLtUYgVRKqWRczh2wINcvDY8WuWoMpIETxWpYhIbrZ-w46xB1v2YMADbOfrFNxLhiyIC239GIQRC__Tw_KiYoZiK1A#=“

i dont have any idea if it’s returning me something or anything else.
What i want is that i am able to post “hello world” at my facebook page.Here’s my php code.

require_once('facebook.php');


$config = array(
'appId' => 'xxxxx',
'secret' => 'xxxxxxxxxx',
'cookie' => 'true'
  );

$facebook = new Facebook($config);
$user_id = $facebook->getUser();

$user_profile=null;  

if($user_id) 
{

  try 
  {
        $user_profile = $facebook->api('/me');
        $facebook->api('/me/feed','post',array(
        'message'=>'hello world'
        ));

  } 
  catch(FacebookApiException $e) 
  {
        echo $e->getMessage();
  }   

}

if($user_id)
{
    $logout_url=$facebook->getLogoutUrl();  
    echo "<a href='$logout_url'>Logout</a>";
}
else
{
    $login_url=$facebook->getLoginUrl(array(
    'scope'=>'read_friendlists,publish_stream,email,user_work_history,user_website,user_religion_politics,user_relationship_details,user_relationships,user_interests,user_hometown,user_education_history,user_birthday,user_about_me'
    ));
    echo "<a href='$login_url'>Login</a>";

}
  • 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-31T13:08:27+00:00Added an answer on May 31, 2026 at 1:08 pm

    Mauzzam,

    This code works for me – please take a look at the examples folder in the PHP SDK

    <?php
    require '../src/facebook.php';
    
    // Create our Application instance (replace this with your appId and secret).
    $facebook = new Facebook(array(
      'appId'  => '350881691595504',
      'secret' => 'a50ae255f0ba3c24000e38ede7f666b9',
    ));
    
    $user = $facebook->getUser();
    
    if ($user) {
      try {
        $response = $facebook->api('/me/feed','post',array(
          'message'=>'hello world'
        ));
      } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
      }
    }
    
    // Login or logout url will be needed depending on current user state.
    if ($user) {
      $logoutUrl = $facebook->getLogoutUrl();
    } else {
      $loginUrl = $facebook->getLoginUrl();
    }
    
    ?>
    <html xmlns:fb="http://www.facebook.com/2008/fbml">
      <head>
        <title>PHP SDK TEST</title>
      </head>
      <body>
        <?php if ($user): ?>
          <a href="<?php echo $logoutUrl; ?>">Logout</a>
        <?php else: ?>
          <div>
            Login using OAuth 2.0 handled by the PHP SDK:
            <a href="<?php echo $loginUrl; ?>">Login with Facebook</a>
          </div>
        <?php endif ?>
    
        <?php if ($user): ?>
          <h3>Hello World Result</h3>
          <pre><?php print_r($response); ?></pre>
        <?php else: ?>
          <strong><em>You are not Connected.</em></strong>
        <?php endif ?>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed this tutorial , and included a video player in my app. But
I followed this link to make use of recent files list but statement below
I followed this tutorial and got the basics of Content Providers : http://www.vogella.de/articles/AndroidSQLite/article.html But
I have followed many a tutorial to make sure that this is correct but
I've followed the tutorial here to load video files into a C program. But
Followed this question about delayed_job and monit Its working on my development machine. But
I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
I followed this guide here perfectly and have gone through it again but when
I followed this tutorial here: http://www.dannyherran.com/2011/02/facebook-php-sdk-and-codeigniter-for-basic-user-authentication/ It works great but when I enable CSRF
I followed this tutorial http://www.tugberkugurlu.com/archive/api-key-authorization-through-query-string-in-asp-net-web-api-authorizationfilterattribute to create custom Authorization filter. I have CarController with

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.