简体   繁体   中英

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.

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;
        }
    }
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM