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

  • Home
  • SEARCH
  • 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 8975469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:53:24+00:00 2026-06-15T18:53:24+00:00

i am using Graph api to create a facebook app with PHP . require_once(facebook.php);

  • 0

i am using Graph api to create a facebook app with PHP .

require_once("facebook.php");
  $config = array();
  $config[‘appId’] = 'xxxxxxxxxxx';
  $config[‘secret’] = 'xxxxxxxxxxxxxxxxxxxxx'; // NEVER USED THIS , JUST INCLUDED IT !
  $config[‘fileUpload’] = true; // optional
  $facebook = new Facebook($config);


$app_id = "xxxxxxxxx";
    $app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $my_url = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

 $token_url = "https://graph.facebook.com/oauth/access_token?"
       . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url)
       . "&client_secret=" . $app_secret . "&code=" . $code;

     $response = file_get_contents($token_url);
     $params = null;
     parse_str($response, $params);

     $graph_url = "https://graph.facebook.com/me?access_token=" 
       . $params['access_token']; // The acess call :)

       $at = $params['access_token']; // I USE THIS ACCESS TOKEN

I now use that access token ($at) to make requests . But i need to store the access_token for much longer time (60 days) .

So
1)how do i use setExtendedAccessToken() method &
2) where i should put that in my code &
3) where can i obtain the output from

I am including the PHP SDK too , even though i am not using it .

  • 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-15T18:53:25+00:00Added an answer on June 15, 2026 at 6:53 pm

    You can exachange temporary Token for Extended Token. check below code.

    try {
            $graph_url   =  "https://graph.facebook.com/oauth/access_token?";
            $graph_url  .=  "client_id=".$FB_APP_ID;
            $graph_url  .=  "&client_secret=".$FB_APP_SECRET;
            $graph_url  .=  "&grant_type=fb_exchange_token";
            $graph_url  .=  "&fb_exchange_token=".$fb_temp_access_token;
    
            $response   = @file_get_contents($graph_url);            
            $params     = null;
            parse_str($response, $params);
    
            $new_token  =$params['access_token'];
    
        } catch (Exception $e) {
           //DO NOTHING
        }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an APP on Facebook and using graph API explorer, I selected my
I want to create a Login through Facebook on a website using Graph API
I'm using Facebook Graph API on Google App Engine. I was able to fetch
I´m using Facebook graph API thru the JS SDK and the Php SDK. While
I'm using Graph API to create and get events from facebook. Try in various
I'm trying to connect to Facebook's graph api using the PHP-SDK. The session is
i'm using graph api to connect to facebook. now i want to get the
I have been working on a facebook application which will be using Graph API
Follow up to this question for Facebook Friends.getAppUsers using Graph API that pulls friends
I'm trying to publish checkin using Facebook Graph API. I've gone through Facebook API

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.