开发者

how to add share action to the post in facebook?

开发者 https://www.devze.com 2023-04-06 08:03 出处:网络
i\'m using this code to pos开发者_StackOverflow中文版t to my application wall $attachment = array(\'message\' => \'xxxxxxxxxxxxxxxx...\',

i'm using this code to pos开发者_StackOverflow中文版t to my application wall

$attachment = array('message' => 'xxxxxxxxxxxxxxxx...',
            'name' => 'xxxxxxxxxxxxxxxxxxx',
            'caption' => 'xxxxxxxxxxxxxxxxxx',
            'link' => 'xxxxxxxxxxxxxxxxxx',
            'description' => 'xxxxxxxxxxxxxxxxxx',
            'picture' => 'xxxxxxxxxxxxxxxxxx',
            'actions' => array(array('name' => 'Download!',
                              'link' => 'xxxxxxxxxxxxxxxxxx'))
            );

$result = $facebook->api('/2222222222222/feed/','post',$attachment); 

when i post to my application wall manually the post is appearing on the application users wall with the share action but when i use the above code it only appear on the app wall with like and comment actions only. why? and how to add the share action to the actions array?


i didn't find any answer online, but i just found the solution to my problem by chance i removed the action parameter from the attachment.

but if there is a link parameter in the attachment the share action won't appear so you will have to give up the link parameter.


the proper names for the action link is: array( array('text' => 'Download!', 'href' => 'xxxxxxxxxxxxxxx'));

Keep in mind that you can't use action links in the graph api (yet). so this functionality is limited to the REST api.

Let me know if this helps


http://facebookanswers.co.uk/?p=270

This article explains it. The key is this:

'actions' => array('name'=>'Sweet FA','link'=>'http://www.facebookanswers.co.uk'),

This is fine for adding one action. However, I'm not sure how to add two.


Hi the solution is here instead of

$result = $facebook->api('/2222222222222/feed/','post',$attachment); 

use

$result = $facebook->api('/2222222222222/links/','post',$attachment); 

i'm still facing one little problem with the picture not showing after this change, if i come to a solution to it I'll come back here and post it.

0

精彩评论

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