2011-11-09 79 views
3

我在标记帖子中的人员时遇到了一些严重问题。我现在正在使用CakePHP并使用FB API将POST发布到Graph API。下面的代码:在POST帖子中添加帖子到Facebook图表API

$theMsg1 = $this->Connect->user('name').' tagged '; 
    $theMsg2 = $friendName.' on the IF Tag website.'; 
    $msg1Len = strlen($theMsg1); 
    $fbNameLen = strlen($friendName);` 

    $fbcall = FB::api($fbID.'/feed', 'POST', array(
     'name' => $theTag['Tag']['name'], 
     'caption' => 'IF Tag is an application that allows you to interact with people on Facebook.', 
     'message' => $theMsg1.$theMsg2, 
     'message_tags' => array(
      $msg1Len => array(
       'id' => $friendID, 
       'name' => $friendName, 
       'offset' => $msg1Len, 
       'length' => $fbNameLen 
      ), 
      'picture' => 'http://patronsocialclub.com/img/global/head/drinkmaker.gif', 
      'link' => 'iftag.local' 
     ) 
    )); 

据我了解和我读过,我应该使用message_tags对象标记在后的人,但它不工作。它不会给出任何错误,只是不标记。

我也尝试使用@[{userid}:1:{username}]从我见过的其他帖子,但似乎不适用于当前的API迭代。

+0

任何人都有任何线索? –

回答

2

见我的答案在这里Facebook Graph API Post with_tags option

它的要点是

我想你想使用什么是公正的“标签”和它应该只包含此处指定的ID https://developers.facebook.com/docs/reference/api/user/#posts

**请注意,您不能在不指定地点的情况下做到这一点

Facebook现在已经发布了提及标记,这可能是您需要的解决方案https://developers.facebook.com/docs/opengraph/mention_tagging/,但它需要自定义打开的图形操作。