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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:39:56+00:00 2026-06-06T01:39:56+00:00

Background I’m having a bit of trouble finding out just how to programmatically post

  • 0

Background

I’m having a bit of trouble finding out just how to programmatically post photos to a Facebook Page. I’ve read through the Facebook Documentation on Authenticating as a Page, but all the examples involve Facebook Users. So far I’ve just generated the needed access tokens manually using Facebook’s Graph API Explorer. (3)

What I’ve tried

Using this simple code, I was successful in uploading the picture, however it was posted on my own wall, in my own album under my own name, not the on the Facebook Page, in the Facebook Page‘s album under the Facebook Page‘s name. I need to post it on a specific Facebook Page as the Facebook Page itself. (1)

<?php
require 'facebook-php-sdk/src/facebook.php';
require 'config.php';

$facebook = new Facebook(array(
    'appId' => $config['facebook_appId'],
    'secret' => $config['facebook_appSecret'],
    'fileUpload' => true
));

$facebook->setAccessToken($config['facebook_pageAccessToken']);

$args = array(
    'message' => 'Facebook API test',
    'source' => '@'.realpath(__DIR__.'/404.jpg')
);

$data = $facebook->api('/'.$config['facebook_pageId'].'/photos', 'post', $args);

About the code

  • $config['facebook_appId'] is from a dummy test app I created
  • $config['facebook_appSecret'] is from a dummy test app I created
  • $config['facebook_pageAccessToken'] is generated from the Graph API Explorer using the scope manage_pages, publish_stream, photo_upload and offline_access (3)
    • As a side note to potential future visitors, it turns out I generated a User Access Token instead of a Page Access Token, which is the reason it was posted on my own wall, in my own album as myself.
  • $config['facebook_pageId'] is the ID of the page (which I also found using the Graph API Explorer)
  • Upon successful completion $data contains the ID of the image and the wall post(?) it seems

Question summary

  1. How can I post photos to a Facebook Page as the Facebook Page itself?
  2. This is for a project where developers are coming and going. Is there a way for me to have an immutable Page Access Token independent of a specific Facebook User OR dependent on a (dummy) Facebook App OR generating one on the fly somehow?
  3. How can I (if necessary) authenticate as a Facebook Page – giving me a Page Access Token, programmatically in PHP?

Code examples or links to concise documentation and/or tutorials preferably with examples will be much appreciated.

  • 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-06T01:40:06+00:00Added an answer on June 6, 2026 at 1:40 am

    The answer to all three is:

    • Get the user, who is an admin of the page, to grant your app manage_pages permission

    • If you did this client-side (i.e Javascript SDK), you’ll want to extend their access token using the instructions for Scenario 4 on https://developers.facebook.com/roadmap/offline-access-removal/

    • Retrieve the access_token for the page via a call to /me/permissions or a call to /[PAGE_ID]/?fields=access_token. If you extended the page admin’s access_token before retrieving the page access token, the page access token will not expire unless the user stops being an admin of the page or changes their password, revokes permission to the app, etc (Scenario 5 on the doc above)

    • Use that access token to upload the photo to the page’s wall.

    I think most of these steps are clarified here: https://developers.facebook.com/docs/authentication/pages/ (logging in as the page) or in this the Page documentation

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

Sidebar

Related Questions

Background: I have an opc tag whose value is a 32 bit floating point
Background Hi All, I'm trying to use Boost::MPI, at the moment I'm just trying
[background below] I've got my data modelled out in SQLObject in Python on the
Background I have a basic HTML page with an iframe that points to a
Background: I have some existing apps in the App Store and I have just
Background: I'm working through the Programming Collective Intelligence book by Toby Segaran; specifically the
Background : I'm working on a management page for musicians. Lets say the user
Background: I'm trying to use a Google Map as an interface to mark out
Background: What I need to accomplish is to remove any records in a collection
Background: We're building an application that allows our customers to supply data in a

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.