2012-07-25 133 views
0

我以前使用stream.publish方法来做到这一点,我在其中指定了.swf的源文件以及其他参数以呈现媒体,但现在已弃用。我怎样才能使用Graph API来做到这一点?特别是Facebook PHP SDK。Facebook - 使用PHP SDK发布.swf到用户墙壁

回答

2

使用PHP SDK,你可以发布他们是这样的:

$facebook->api('/me/feed', 'post', array(
    'type'=>'video', 
    'source'=>'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf', 
    'picture'=> 'http://fbrell.com/f8.jpg', 
    'name'=> 'Facebook Dialogs', 
    'caption'=> 'Reference', 
    'description'=> 'Using Dialogs to interact with users.', 
); 

你应该能够在link属性加进来,但似乎在Facebook的API来bug在这时,使其中的link的帖子可以防止嵌入swf。这种方式将被嵌入,但是由此产生的帖子中的名称将指向swf文件,该文件不好。与从js sdk发布的链接相同的值不会显示此行为。

一种解决方法可能是创建与正确的opengraph元标记的链接,并将其张贴为type => 'link'

HTML文件(视频由YouTube赞助)

<html> 
<head> 
    <title>Fly, you fools!</title> 
    <meta property="og:title" content="Fly, you fools!" /> 
    <meta property="og:type" content="website"/> 
    <meta property="og:description" content="Content for Description" /> 
    <meta property="og:image" content="http://i2.ytimg.com/vi/meOCdyS7ORE/mqdefault.jpg" /> 
    <meta property="og:site_name" content="Content for caption"/> 
    <meta property="og:video" content="http://www.youtube.com/v/meOCdyS7ORE?version=3&autohide=1"> 
    <meta property="og:video:type" content="application/x-shockwave-flash"> 
    <meta property="og:video:width" content="640"> 
    <meta property="og:video:height" content="360"> 
</head> 
<body> 
<script> 
    window.location = 'http://disney.com'; // redirecting users who's clicking on the link, wont affect crawlers since its in js. 
</script> 
</body> 
</html> 

PHP SDK调用共享

$this->facebook->api('/me/feed', 'post', array(
    'type' => 'link', 
    'link' => 'http://.../', // put the html file's location here 
)); 
+0

谢谢复杂的,这是什么应该做,但它似乎不起作用。看来FB目前正在探讨这种特定类型的帖子(幸运的是我),所以我想我必须等到它解决。 – 8vius 2012-07-25 21:02:45