本文整理匯總了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;
}