Exemplo n.º 1
0
 /**
  * @return GraphEdge
  */
 public function getFeed()
 {
     $sinceDate = new \DateTime($this->startingDate);
     $request = new FacebookRequest($this->facebookApp, $this->facebookAccessToken, 'GET', sprintf('/%d/posts', $this->facebookPageId), ['fields' => 'message, created_time, status_type, attachments, place', 'since' => $sinceDate->getTimestamp()]);
     $fb = new Facebook(["app_id" => $this->facebookApp->getId(), "app_secret" => $this->facebookApp->getSecret(), "default_graph_version" => 'v2.5']);
     $fb->setDefaultAccessToken($this->facebookAccessToken);
     try {
         $response = $fb->getClient()->sendRequest($request);
     } catch (FacebookResponseException $e) {
         // When Graph returns an error
         echo 'Graph returned an error: ' . $e->getMessage();
         exit;
     } catch (FacebookSDKException $e) {
         // When validation fails or other local issues
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
         exit;
     }
     $timelineObject = $this->timelineObjectFiller($response->getGraphEdge());
     return $timelineObject;
 }
Exemplo n.º 2
0
 /**
  * Returns the client_* params for OAuth requests.
  *
  * @return array
  */
 protected function getClientParams()
 {
     return ['client_id' => $this->app->getId(), 'client_secret' => $this->app->getSecret()];
 }
Exemplo n.º 3
0
 public function testGetId()
 {
     $this->assertEquals('id', $this->app->getId());
 }