コード例 #1
0
 protected function _attach()
 {
     try {
         $sdk = new ig\SDK();
         if ($session = $sdk->obtainToken(Url::base('influencer/social/instagram/'))) {
             $session = json_decode(json_encode($session), true);
             $sdk->setAccessToken($session['access_token']);
             $user = $sdk->getUser($session['user']['id']);
             $user['access_token'] = $session['access_token'];
             $influencer = new Influencer(UserSession::get('user._id'));
             $influencer->modify(array('_id' => $influencer->id), array('$set' => array('social.instagram' => $user), '$pull' => array('social_invalidated' => 'instagram')));
         }
     } catch (ig\InstagramAccessTokenException $e) {
         Alert::once('error', 'Failed to add account: ' . $e->getMessage(), Url::base('influencer/social'));
     }
     Alert::once('success', 'Account added successfully', Url::base('influencer/social'));
 }
コード例 #2
0
ファイル: Social.php プロジェクト: ravikathaitarm01/fluenz1
 protected function _fetch_instagram($u, &$info, $social)
 {
     try {
         $sdk = new ig\SDK();
         $token = $info['access_token'];
         $sdk->setAccessToken($token);
         $info = $sdk->getUser($info['id']);
         $info['access_token'] = $token;
     } catch (ig\InstagramAccessTokenException $e) {
         $this->_notify_invalidate($u['_id'], $social);
     }
 }