我正在拼命地寻找我的facebook应用程序的图像附件php api馈送。
基本上,我想要做的是发送一个图片附件,以及一个自动的“发布到好友墙”动作。
它背后的想法是,用户发送一个“虚拟汉堡”到他们的好友墙上,并附上一条消息,向他们提供折扣。
这是成功发送邮件的代码片段,但我无法使附件工作。
if($_REQUEST['friend_1']!='' && $_REQUEST['friend_1']!="Start typing a friend's name") {
try {
$fql1 = "select name from user where uid=" . $_REQUEST['friend_1'];
$param1 = array(
'method' => 'fql.query',
'query' => $fql1,
'callback' => ''
);
$fqlResult1 = $facebook->api($param1);
$friend_1_name = $fqlResult1[0]['name'];
$statusUpdate = $facebook->api('/'.$_REQUEST['friend_1'].'/feed', 'post', array('link' => $fanpageURL, 'name' => 'Have a virtual Unity Burger.', 'description' => " ".$user_name." just sent you a virtual Unity Burger. If you would rather have the real thing then come add your name on the Unity list and we will give you a 20% discount on your next visit and an exclusive Unity keyring.", 'properties' => '', 'cb' => ''));
} catch (FacebookApiException $e) {
//echo "Notification not send to user ".$fqlResult1[0]['name']."<br>";发布于 2011-09-14 17:16:24
我认为有两种方法可以将图像附加到墙柱上。
第一种方法是在目标页面中定义meta :image,并将链接发布到好友墙。Facebook将查询目标并获取Open Graph信息,将其显示在墙上。您可以使用Facebook Debugger来测试这一点。
meta属性应如下所示:
<meta property="og:image" content="http://url.to/image" />您还可以定义其他Open Graph属性,如标题、描述等。
将图像附加到帖子的第二种方法是在Graph API调用中包含图片参数。在您的代码中,您只定义了一些参数(链接、名称、描述...)但你也可以发送图片,标题,信息...
所以你的API调用可能是这样的:
$params = array( 'access_token' => '',
'message' => '',
'link' => '',
'picture' => '',
'name' => '',
'caption' => '',
'description' => ''
);
$wallPost = $facebook->api('/'.$to.'/feed', 'post', $params);https://stackoverflow.com/questions/7413099
复制相似问题