示例#1
0
 public function exchange_long_lived_token($access_token)
 {
     $session = new FacebookSession($access_token);
     // Check validate token
     if ($session->validate()) {
         $long_lived_session = $session->getLongLivedSession();
         return $long_lived_session->getToken();
     }
     return false;
 }
 /**
  * @return string
  */
 public function getLongLivedToken()
 {
     $longLivedSession = $this->session->getLongLivedSession($this->appId, $this->appSecret);
     return $longLivedSession->getToken();
 }
示例#3
0
文件: news.php 项目: jojoee/autofeed
 public function facebook_page_long_lived_session()
 {
     $this->set_facebook_app();
     $page_ids = $this->fb_model->get_all_page_ids();
     $results = array();
     foreach ($page_ids as $page_id) {
         $page_id = $page_id['value'];
         if (!is_null_or_empty_string($page_id)) {
             if (is_null_or_empty_string($page_id)) {
                 $page_id = $this->page_id;
             }
             $request = new FacebookRequest($this->user_session, 'GET', '/' . $page_id . '?fields=access_token');
             $request_results = $request->execute()->getGraphObject()->asArray();
             $page_access_token = $request_results['access_token'];
             $page_session = new FacebookSession($page_access_token);
             $results[] = array('info' => $page_session->getSessionInfo(), 'longlive' => $page_session->getLongLivedSession());
         }
     }
     dd($results);
 }