简体   繁体   English

PHP Facebook API-将消息发布到墙上,并带有指向用户的链接?

[英]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. 我知道我无法通过Facebook API消息通过Facebook以外的链接发布到用户的墙上。

But can I post a message, where would be a link to a Facebook user? 但是我可以发布一条消息吗,到Facebook用户的链接在哪里? 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. 使用/me/feed端点,您可以将其发布到用户的墙上,没有任何东西可以阻止它。

You will need publish_stream permission. 您将需要publish_stream权限。

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. 我知道我无法通过Facebook API消息通过Facebook以外的链接发布到用户的墙上。

You surely can, using the feed api 您一定可以使用Feed API

If the user have given you the permission to publish , you can post any link on his wall. 如果用户已授予您发布权限,则可以在其墙上张贴任何链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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