我使用旧的Rest API(和旧的Javascript SDK)在Facebook内开发iframe应用程序。如何在流中包含html.Publish
但是我想让墙上的帖子(名为stream.Publish)包含新的行和人名以及链接到他们的个人资料。但是我每次包括HTML内容时,FB条..但我知道这是可以做到的,因为一些应用程序做到这一点,例如:
http://img.skitch.com/20100702-jhqradpi3td4d53sdb3qin92sb.png
干杯, 泽
我使用旧的Rest API(和旧的Javascript SDK)在Facebook内开发iframe应用程序。如何在流中包含html.Publish
但是我想让墙上的帖子(名为stream.Publish)包含新的行和人名以及链接到他们的个人资料。但是我每次包括HTML内容时,FB条..但我知道这是可以做到的,因为一些应用程序做到这一点,例如:
http://img.skitch.com/20100702-jhqradpi3td4d53sdb3qin92sb.png
干杯, 泽
你不能有在墙上张贴任意的HTML。如果它看起来像HTML,Facebook将剥离它。我相信Facebook将做的唯一的其他变更就是将链接看起来像链接转换成链接(所以如果你在邮件的某个地方有http://www.google.com,Facebook会自动将它变成链接)。
但是Facebook并通过传递额外的参数,包括像图片,标题,描述,链接等通过stream.publish基本的东西,提供基本的设施。这是包括一些这些东西从Facebook的文档(http://wiki.developers.facebook.com/index.php/Stream.publish)的例子:
$message = 'Check out this cute pic.';
$attachment = array(
'name' => 'i\'m bursting with joy',
'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/',
'caption' => '{*actor*} rated the lolcat 5 stars',
'description' => 'a funny looking cat',
'properties' => array('category' => array(
'text' => 'humor',
'href' => 'http://www.icanhascheezburger.com/category/humor'),
'ratings' => '5 stars'),
'media' => array(array('type' => 'image',
'src' => 'http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg',
'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/')),
'latitude' => '41.4', //Let's add some custom metadata in the form of key/value pairs
'longitude' => '2.19');
$action_links = array(
array('text' => 'Recaption this',
'href' => 'http://mine.icanhascheezburger.com/default.aspx?tiid=1192742&recap=1#step2'));
$attachment = json_encode($attachment);
$action_links = json_encode($action_links);
$facebook->api_client->stream_publish($message, $attachment, $action_links);
检查this出来什么附件可以包含更多的信息。