我们正在编写一个Facebook应用程序,当他们参加比赛时,会在人们的墙上创建一个帖子。我们对正在创建的帖子的内容有疑问。
状态消息和链接按预期运行,但图片,名称,标题和说明将从帖子链接到的页面中抓取。
这是我们用来发布到人们墙上的代码:
$facebook->api("/me/feed", "post", array(
message => "I've just chosen my kangaroo to win a ticket to the Caravan, Camping and Off-Road Sale at the Adelaide Showgrounds (August 2-5). Be quick, there are only 1000 tickets up for grabs! Just click the link below.",
picture => "http://gmbo.com.au/hosted/cca/pak/app-icon.png",
link => "http://www.facebook.com/pages/WEIM-Sandbox-2/241942125896015?sk=app_416990981685156",
name => "CLICK HERE",
caption => "If you love caravans, camping or outdoor recreation - you'll love this Show.",
description => "If you love caravans, camping or outdoor recreation - you'll love this Show."
非常感谢任何帮助,这个Facebook API的东西可能非常令人沮丧。
由于
答案 0 :(得分:2)
您缺少每个属性的' '
。另外,你忘了关闭括号。
$facebook->api("/me/feed", "post", array(
'message' => "I've just chosen my kangaroo to win a ticket to the Caravan, Camping and Off-Road Sale at the Adelaide Showgrounds (August 2-5). Be quick, there are only 1000 tickets up for grabs! Just click the link below.",
'picture' => "http://gmbo.com.au/hosted/cca/pak/app-icon.png",
'link' => "http://www.facebook.com/pages/WEIM-Sandbox-2/241942125896015?sk=app_416990981685156",
'name' => "CLICK HERE",
'caption' => "If you love caravans, camping or outdoor recreation - you'll love this Show.",
'description' => "If you love caravans, camping or outdoor recreation - you'll love this Show."
));
如果仍然无效,请检查您是否在fbmain.php中允许publish_stream
权限。
您可以参考PHP SDK and JavaScript SDK Feed Dialog了解更多示例。
答案 1 :(得分:-1)
此代码没有任何问题。你不需要引号。
这是一个Facebook API错误。我们尝试了你提到的,但是有一个已知的错误。我们试图做的事情对于可怜的小Facebook来说太过雄心勃勃,无法包裹它的小脑袋。