开发者

Facebook api : FB.UI to post on wall

开发者 https://www.devze.com 2023-02-27 02:06 出处:网络
I would like to give the possibility to the user to post on its wall on click of a link on my fanpage

I would like to give the possibility to the user to post on its wall on click of a link on my fanpage

Below my main.php file

<div style="margin: 40px auto; width: 300px; border: 1px solid #c0c0c0; padding: 10px; overflow: hidden;">
    <img src="http://graph.facebook.com/<?php echo $uid; ?>/picture" alt="<?php echo $me['id']; ?>" style="float: left; border-width:0px; margin-right: 10px;" />Bonjour Mr <?php echo $meo['last_name']; ?> !<br />
    Selectionner vos photos YK ?<br /><br /><br />
    Votre identifiant <?php echo $me['id']; ?>
</div>
<div>
    <a onclick="publishWall();return false;" href="#">Poster un article sur mon mur via l'API Javascript</a>
</div>
    ...
<script type="text/javascript">
    function publishWall(){
        FB.ui({
开发者_如何学JAVA            method: 'stream.publish',
            message: '',
            attachment:{
                name: "Démo Symfony+Facebook",
                caption: '',
                description: "Une démo simple d'application Facebook avec Symfony et les dernières API Javascript et PHP de Facebook.",
                href: "http://www.lexik.fr/blog/symfony/non-classe/exemple-dapplication-utilisant-la-graph-api-de-facebook-1187"
            },
            user_prompt_message: "Application de démo Symfony+Facebook"},
            function (response) {}
        );
    }
</script>


Use the feed method instead:

<h1>feed</h1>
<p>
Publishing to the stream is easy, as all the fields are optional. Just specify
what you need, and leave the rest out.
</p>

<script>
var publish = {
  method: 'feed',
  message: 'getting educated about Facebook Connect',
  name: 'Connect',
  caption: 'The Facebook Connect JavaScript SDK',
  description: (
      'A small JavaScript library that allows you to harness ' +
      'the power of Facebook, bringing the user\'s identity, ' +
      'social graph and distribution power to your site.'
  ),
  link: 'http://fbrell.com/',
  picture: 'http://fbrell.com/f8.jpg',
  actions: [
    { name: 'fbrell', link: 'http://fbrell.com/' }
  ],
  user_message_prompt: 'Share your thoughts about RELL'
};

FB.ui(publish, Log.info.bind('feed callback'));
</script>

Example taken from the Facebook Test Console (Examples->FB.ui->feed).


I'm afraid that you wont be able to post a photo in the user's albums using FB.UI

You will have to use the graph api first to post your picture : http://developers.facebook.com/docs/reference/api/photo/

And then you can publish a wall post refering to that picture (I'm not sure if publishing a picture in a photo album also publish on the wall, I think so)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号