facebook API心得手扎-stream.publish
推
噗
分類於《工作五四三》
facebook於上周六公佈消息,自今年12月20日開始將不再支援下列的feed API:
» Template bundles. You should start using stream attachments with the stream publishing methods instead.
» feed.publishUserAction
» feed.publishTemplatizedAction
» Facebook.showFeedDialog and FB.Connect.showFeedDialog
» Publisher stories that use templates (please transition them to use stream attachments).
» Feed forms that reference the feedStory form and the multiFeedStory form.
» One-line stream stories.
» feed.publishUserAction
» feed.publishTemplatizedAction
» Facebook.showFeedDialog and FB.Connect.showFeedDialog
» Publisher stories that use templates (please transition them to use stream attachments).
» Feed forms that reference the feedStory form and the multiFeedStory form.
» One-line stream stories.
這也意味著要發佈訊息到自己或朋友的頁面,得要改用新的stream.publish函式。

昨天嘗試做了一下:
$message = ‘這是訊息’; //(A)
$attachment = array(
』name』=>』附件主要標題』, //(B)
』href』=>』http://apps.facebook.com/xxxxxxx/』,
』description』=>』叭啦叭啦叭啦叭啦叭啦叭啦一長串的說明文字』, //(C)
』media』 => array(
array(
』type』 => 『image』,
』src』 => 『http://farm3.static.flickr.com/2643/3979186255_1bd46aa15b.jpg』,
』href』 => 『http://www.flickr.com/photos/cupidtsao/sets/72157622512555988/』
)
)
);
$action_links = array(
array(
』text』=> 『動作超連結』, //(D)
』href』=> 『http://apps.facebook.com/xxxxxxx/yyyy.php』
)
);
$attachment = array(
』name』=>』附件主要標題』, //(B)
』href』=>』http://apps.facebook.com/xxxxxxx/』,
』description』=>』叭啦叭啦叭啦叭啦叭啦叭啦一長串的說明文字』, //(C)
』media』 => array(
array(
』type』 => 『image』,
』src』 => 『http://farm3.static.flickr.com/2643/3979186255_1bd46aa15b.jpg』,
』href』 => 『http://www.flickr.com/photos/cupidtsao/sets/72157622512555988/』
)
)
);
$action_links = array(
array(
』text』=> 『動作超連結』, //(D)
』href』=> 『http://apps.facebook.com/xxxxxxx/yyyy.php』
)
);
try {
$facebook->api_client->stream_publish($message, $attachment, $action_links, NULL, 』);
} catch(Exception $e) {
switch ($e->getCode()) {
case 200:
echo ‘警告!您必須先開放發佈資訊的權限。’;
echo ‘<fb:prompt-permission perms=』publish_stream』>允許張貼您的作品</fb:prompt-permission>’;
break;
default:
echo ‘<br>Error message: ‘.$e->getMessage().’ Error code:’.$e->getCode().’<p>’;
}
}
$facebook->api_client->stream_publish($message, $attachment, $action_links, NULL, 』);
} catch(Exception $e) {
switch ($e->getCode()) {
case 200:
echo ‘警告!您必須先開放發佈資訊的權限。’;
echo ‘<fb:prompt-permission perms=』publish_stream』>允許張貼您的作品</fb:prompt-permission>’;
break;
default:
echo ‘<br>Error message: ‘.$e->getMessage().’ Error code:’.$e->getCode().’<p>’;
}
}
引用連結 

content rss

will said:
Dear
請問您的範例是建立在FBML還是iframe底下呢??
我被stream publish困擾了好久
希望有人能救救我~~
謝謝
十一月 12th, 2009 於 4:14 下午
cupid said:
FBML
十一月 23rd, 2009 於 8:20 上午
Michael said:
(私密留言) 請問先知 ~
我用 WinForm
facebookService1.Stream.Publish(…)
結過得到 A session key must be specified when request is signed with a session secret 錯誤訊息! 請問該如何解決
七月 29th, 2010 於 2:53 下午