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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:28:57+00:00 2026-06-10T21:28:57+00:00

Is it possible to post to a friends wall/timeline in facebook using an app

  • 0

Is it possible to post to a friends wall/timeline in facebook using an app even if the user is not currently logged in? Here’s the code that I’m currently working on, as you can see it posts a message on a friends wall(substitute the friend_id with an actual profile id). This works but a user has to logged in in order to perform this operation.
I don’t have any idea what to do if I want this script to execute automatically(without user intervention).

<?php
require 'php_sdk/src/facebook.php';

$facebook = new Facebook(array(
  'appId'  => 'XXX',
  'secret' => 'XXX',
));

$session = $facebook->getUser();
$me = null;

if($session){
    try{
        $me = $facebook->api('/me');

        $facebook->api('/friend_id/feed', 'post', array('message'=>'hello without user!'));

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

if($me){
    $logoutUrl = $facebook->getLogoutUrl();
    echo "<a href='$logoutUrl'>Logout</a>";
}else{
    $loginUrl = $facebook->getLoginUrl(array(
        'scope' => 'user_about_me,user_birthday,user_location,email,read_friendlists,friends_location,friends_birthday,publish_stream'
    ));
    echo "<a href='$loginUrl'>Login</a>";
}
?>

Any ideas? Code samples, and links to specific documents that can help me gain a bit of idea on how this works is greatly appreciated thanks!

  • 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-10T21:28:58+00:00Added an answer on June 10, 2026 at 9:28 pm

    When the user is logged in, you need to trap their “Access Token”

    $facebook = new Facebook(array( 
      'appId'  => 'XXX', 
      'secret' => 'XXX', 
    )); 
    
    // NOTE: wrap these in try/catch blocks for safety - this is example only
    $session = $facebook->getUser(); 
    $access_token = $facebook->getAccessToken(); 
    

    To post as them later, you use the access token

    $facebook = new Facebook(array( 
      'appId'  => 'XXX', 
      'secret' => 'XXX', 
    )); 
    
    // NOTE: wrap these in try/catch blocks for safety - this is example only
    $facebook->setAccessToken($access_token); 
    // Then check /me and you should still have the same user.
    // Then post to /me/feed to post to the wall.
    

    The token will be valid for 2 days. You can extend this to 60 days if you want.


    Edit: For exenteding the token, you call the function

    $facebook->setExtendedAccessToken();
    

    immediately before “getAccessToken” call.

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

Sidebar

Related Questions

Using JavaScript SDK, it is possible to wall post with user's consent. Since It
Currently I'm able to post mesages and pictures to my wall using my app,
It's now possible to tag friends and location in feed post https://developers.facebook.com/blog/post/2012/03/07/building-better-stories-with-location-and-friends/ according to
Is it possible to post a message on the wall of the group, using
Is it possible to post a photo to the wall (and not to the
Is it possible to post something on a users friends wall, without having to
Is it possible to post on a friend's wall from an external source (a
In my current .NET and FBML-based facebook app, I have some code that looks
Possible Duplicate: Post data and retrieve the response using PHP Curl? I want to
Is there any way to post something to a user's friend's wall from that

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.