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

The Archive Base Latest Questions

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

I have been reading the Facebook documentation and I must be missing something, as

  • 0

I have been reading the Facebook documentation and I must be missing something, as I just cant understand how to get the access token for a page without actually logging in first. I am trying to create a PHP function using the PHP facebook API so that when I add new stories or tutorials on my site, my site’s apps can then automatically post as the page a blurb about them on myy facebook page.

I have this function working but only when I get the access token from the Graph API Explorer, though the access tokens expire in about an hour. I can’t seem to figure out how to programatically obtain the access_token for the page and query for a new one each time from within my PHP scripts so they don’t expire and do not require user interaction.

    function post_to_facebook($title, $message, $link, $picture) {

            require '../facebook/src/facebook.php';

            $page_token = 'xxx';

            $page_id = 'xx';

            $facebook = new Facebook(array(
                    'appId'  => '<app_id>',
                    'secret' => '<app_secret>',
                    'cookie' => false,
            ));

            $facebook->setAccessToken($page_token);

            try {
                    $ret_obj = $facebook->api('/'.$page_id.'/feed', 'POST', array(
                                            'caption' => $title,
                                            'link' => $link,
                                            'message' => $message,
                                            'picture' => $picture
                                     ));

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

                    return false;
            }

            return true;
    }

Can someone explain how I can go about retrieving the access token without manually having to look it up via graph api explorer or having a user login?

  • 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-12T12:24:16+00:00Added an answer on June 12, 2026 at 12:24 pm

    It’s not possible.

    The only correct (and legal) way to achieve the access token is with user interaction (through login process).

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

Sidebar

Related Questions

Lately I have been reading a lot of blog topics about big sites(facebook, twitter,
I have been reading the tutorial Controlling Access to Members of a Class .
I have been reading all the Apple documentation on how to handle various events
I have been reading the Phing documentation and it makes sense, but I'm not
I have been reading up on pickers and wanted to try and get a
I have been reading up on maps and understand some of the differences in
I have been reading about websockets and also about socket.io. I understand websockets are
I have been reading over a lot of questions, but cant seem to find
So I have been reading a lot of documentation on HRD and NDB lately,
I have been searching for days and reading over facebook docs but I cannot

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.