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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:17:16+00:00 2026-05-23T01:17:16+00:00

I’m able to post to my Facebook wall page when logged in using a

  • 0

I’m able to post to my Facebook wall page when logged in using a PHP script (and the Graph API). I have a news page on my main website, and would like to push news items out to Facebook as they are posted to my site (which I guess is backwards from how many people use the API).

I’ve granted offline_access and publish_stream to my FB account, for the FB application.

If I close my FB session and try to post from my news page, Facebook presents a login page. I’ve granted access, so I don’t know what else I’m missing.

  • 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-23T01:17:17+00:00Added an answer on May 23, 2026 at 1:17 am

    If I understand your question correctly, I think I have just solved the same problem. I could not solve it entirely using the graph API, but a combination of the graph api and legacy rest api did the trick. Once you have granted permission for your app to post to your facebook page wall, the following code should do what you want:

    $url = "https://graph.facebook.com/oauth/access_token";
    $client_id = "XXXXXXXXXXXXXX";
    $client_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    $postString = "client_id=$client_id&client_secret=$client_secret&type=client_cred";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_FAILONERROR, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
    $token = curl_exec($curl);
    curl_close($curl);
    
    $message = rawurlencode($description.'. Notes:'.$notes);
    $url = "https://api.facebook.com/method/stream.publish";
    $postString = "message=$message&uid=XXXXXXXXXXXXX&$token";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_FAILONERROR, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
    $response = curl_exec($curl);
    curl_close($curl);
    

    Few things worth noting.
    1. The uid in the rest api $postString is the uid for your facebook PAGE. You do not need a target_id because when the uid is of a page it can only publish to itself.
    2. Your $message must be rawurlencoded because that is the form accepted by the rest api.
    3. This will post to your page as your APP, not as the user who made the post to your website. To do that you would need to have the publish_stream permission from all of your users.

    Hope this helps.

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
We're building an app, our first using Rails 3, and we're having to build

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.