Facebook分享帖子 - 仅限标题和图片的URL

时间:2012-07-17 13:52:07

标签: facebook-graph-api facebook-php-sdk

在分享帖子到我的墙上时,我收到完整帖子的链接,而我想显示共享帖子标题和图片的URL。一切正常,除了链接部分。

$result = $facebook->api('/me/feed/', 'post',
    array('name' => $_POST['title'], 
          'link' => 'http://myurl.com', 
          'picture' => $_POST['imgPath'], 
          'caption' => 'post title', 
          'description' => $_POST['description']));     

请建议。

1 个答案:

答案 0 :(得分:0)

Try by removing '/' after feed ..
$result = $facebook->api('/me/feed', 'post',
    array('name' => $_POST['title'], 
          'link' => 'http://myurl.com', 
          'picture' => $_POST['imgPath'], 
          'caption' => 'post title', 
          'description' => $_POST['description']));    
or you can use userid instead of me..
$user=$facebook->getUser();
$result = $facebook->api('/$user/feed', 'post',
    array('name' => $_POST['title'], 
          'link' => 'http://myurl.com', 
          'picture' => $_POST['imgPath'], 
          'caption' => 'post title', 
          'description' => $_POST['description']));