user984621
user984621

Reputation: 48443

PHP Facebook API - post message to the wall with a link to an user?

I know I cannot post through Facebook API messages to the user's wall with the links which go out of Facebook.

But can I post a message, where would be a link to a Facebook user? So far I didn't find something like that, so trying my luck here.

Upvotes: 0

Views: 2183

Answers (2)

Sahil Mittal
Sahil Mittal

Reputation: 20753

I know I cannot post through Facebook API messages to the user's wall with the links which go out of Facebook.

You surely can, using the feed api

If the user have given you the permission to publish , you can post any link on his wall.

Upvotes: 0

phwd
phwd

Reputation: 19995

Using the /me/feed endpoint you can post to the user's wall, nothing prevents it.

You will need publish_stream permission.

if ($user) {
        $attachment = array(
            'message' => 'this is my message',
            'link' => 'http://www.facebook.com/profile.php?id=xxxx',

        );

        try {
            // Proceed knowing you have a user who is logged in and authenticated
            $result = $facebook->api('/me/feed/','post',$attachment);
        } catch (FacebookApiException $e) {
            error_log($e);
            $user = null;
        }
    }
}

Upvotes: 1

Related Questions