本文整理汇总了PHP中FeedItem::getStreamData方法的典型用法代码示例。如果您正苦于以下问题:PHP FeedItem::getStreamData方法的具体用法?PHP FeedItem::getStreamData怎么用?PHP FeedItem::getStreamData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeedItem
的用法示例。
在下文中一共展示了FeedItem::getStreamData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: publishFeedItem
/**
* Format and publish a FeedItem object owned by the given User to the Facebook stream
*
* @param FeedItem $item
* @param bigint target_id - (optional) The Facebook ID of the user, Page, or event where you are publishing the content.
* @return bool
*/
public static function publishFeedItem(FeedItem $item, $target_id = null)
{
// for correct link building and tracking
$item->setBaseNetwork(self::getNetwork());
// if there's no stream data for this feed type on this network, we're done
if (!($data = $item->getStreamData())) {
return null;
}
// try publishing
try {
// this will return the post ID if it's successful
// $message, $attachment = null, $action_links = null, $target_id = null, $uid = null
$result = self::getClient()->api_client->stream_publish($data['message'], $data['attachment'], $data['action_links'], $target_id);
} catch (Exception $ex) {
self::log('facebook ------' . $ex->getMessage());
$result = false;
}
// post ID string or FALSE
return $result;
}