本文整理汇总了PHP中Facebook\FacebookSession::getSessionInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP FacebookSession::getSessionInfo方法的具体用法?PHP FacebookSession::getSessionInfo怎么用?PHP FacebookSession::getSessionInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook\FacebookSession
的用法示例。
在下文中一共展示了FacebookSession::getSessionInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
* @param string $accessToken
* @param string $appId
* @param string $appSecret
* @throws \Vegas\Social\Exception
*/
protected function connect($accessToken, $appId, $appSecret)
{
$session = new FacebookSession($accessToken);
$session->setDefaultApplication($appId, $appSecret);
if ($session->getToken() == $accessToken) {
$this->fbSession = $session;
$this->fbScope = $session->getSessionInfo()->getScopes();
$this->checkPermissions();
return $this;
}
$this->fbSession = false;
throw new \Vegas\Social\Exception\InvalidSessionException();
}
示例2: facebook
/**
* @param string $accessToken
* @return bool
*/
public function facebook($accessToken = null)
{
if (empty($accessToken)) {
return false;
}
FacebookSession::setDefaultApplication(Config::get('verify::facebook.appId'), Config::get('verify::facebook.appSecret'));
$session = new FacebookSession($accessToken);
try {
$session->validate(Config::get('verify::facebook.appId'), Config::get('verify::facebook.appSecret'));
$data = $session->getSessionInfo()->asArray();
return array('valid' => true, 'user_id' => $data['user_id'], 'app_id' => $data['app_id'], 'message' => 'Access Token is valid.');
} catch (FacebookRequestException $ex) {
return array('valid' => false, 'messages' => $ex->getMessage());
} catch (Exception $ex) {
return array('valid' => false, 'messages' => $ex->getMessage());
}
}
示例3: facebook_page_long_lived_session
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);
}
示例4: getFbuid
public function getFbuid()
{
//$session = new FacebookSession( "CAAUhru6r1cwBAEV2ypXEoujW8rsvHW2ZB8LRNyWgaPHzVokFTvjk9q9YjEdomwtCyVSju7vAGkSamTZBbQhg1tGnjZAQNWAOsZAIaqvEjo65aNCL2TXajEatSq3HLLMmLnWuAibnaVYzvjauTpLmRNGk7O8uWP8gbBSPZAsuQJ8IewFLnvB34qM1tMVOcMN3jqmKPSgcnLQZDZD" );
try {
$session = new FacebookSession($this->ci->session->userdata("dmfbat"));
$user_id = $session->getSessionInfo()->asArray()['user_id'];
return $user_id;
} catch (Exception $e) {
return 0;
}
}