当前位置: 首页>>代码示例>>PHP>>正文


PHP Publication::setResponse方法代码示例

本文整理汇总了PHP中Publication::setResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP Publication::setResponse方法的具体用法?PHP Publication::setResponse怎么用?PHP Publication::setResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Publication的用法示例。


在下文中一共展示了Publication::setResponse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createEvent

 /**
  * Creates an event on Facebook.
  *
  * @param string $title Title of the event.
  * @param int $start Epoch timestamp for the event start.
  * @param int $end Epoch timestamp for the event end.
  * @param string $location Location of the event.
  * @param string $description Description of the event.
  * @param string $picture Local path (no URL) of the picture for the event.
  *
  * @return array Result set of the Facebook API call.
  * @todo Standardise the result sets of connection API calls.
  */
 public function createEvent($objectId, $title, $start, $end, $location, $description, $picture = null)
 {
     // Privacy types: OPEN, CLOSED, SECRET
     $start = is_numeric($start) ? date("c", $start) : $start;
     $end = is_numeric($end) ? date("c", $end) : $end;
     $attachment = array("privacy_type" => "OPEN", "name" => $title, "host" => "Me", "start_time" => $start, "end_time" => $end, "location" => $location, "description" => $description);
     if ($picture) {
         $attachment[basename($picture)] = "@" . realpath($picture);
         $this->api()->setFileUploadSupport(true);
     }
     try {
         // TODO: support pages (page Id instead of "me")
         $rs = $this->api()->api('me/events', 'post', $attachment);
     } catch (Exception $e) {
         Log::error("Exception: {$e}");
     } catch (FacebookApiException $e) {
         Log::debug("FacebookApiException {$e}, " . print_r($attachment, true) . print_r($this, true));
         return null;
     }
     $publication = new Publication();
     $publication->setObjectId($objectId);
     $publication->setConnectionId($this->externalId);
     $publication->setBody(serialize($attachment));
     $publication->setResponse(serialize($rs));
     if (isset($rs['id'])) {
         list($uid, $postId) = explode("_", $rs['id']);
         $publication->setExternalId($postId);
     } else {
         $result->error = $rs;
         Log::debug("error: {$result->error}");
     }
     $publication->save();
     return $rs;
     // TODO: invites
     // $fb->api( array(
     //   'method' => 'events.invite',
     //   'eid' => $event_id,
     //   'uids' => $id_array,
     //   'personal_message' => $message,
     // ) );
 }
开发者ID:robkaper,项目名称:kiki,代码行数:54,代码来源:facebook.php


注:本文中的Publication::setResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。