コード例 #1
0
 /**
  * @param $url
  * @param string $type
  * @return array
  */
 private function _fbApiPaginatedCall($url, $type = "")
 {
     $start = microtime(true);
     $result = $this->_fbApi->paginatedCall($url);
     $duration = microtime(true) - $start;
     return $result;
 }
コード例 #2
0
 public function tokenAction()
 {
     $content = '';
     $callbackUrl = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getPathInfo();
     $session = $this->getRequest()->getSession();
     if (!$this->getRequest()->get('code')) {
         $session->set("state", md5(uniqid()));
         $authorizationUrl = Api::authorizationUrl($this->container->getParameter('facebook')['appId'], $callbackUrl, $session->get("state"));
         return $this->redirect($authorizationUrl);
     } elseif ($this->getRequest()->get('state') == $session->get('state')) {
         $fbApi = new Api();
         $userToken = $fbApi->userToken($this->container->getParameter('facebook')['appId'], $this->container->getParameter('facebook')['appSecret'], urlencode($callbackUrl), $this->getRequest()->get('code'));
         $content = $this->_renderAlert('Your token: ' . $userToken);
     } else {
         $content = $this->_renderAlert('The security token has expired. Please reload the page and try again.', 'danger');
     }
     return $this->render('KeboolaFacebookExtractorBundle:Default:token.html.twig', array("content" => $content));
 }