コード例 #1
0
ファイル: helper.php プロジェクト: educakanchay/educared
 private static function getFollowersLinkedin($params)
 {
     if (!class_exists('LinkedInOAuth')) {
         require_once dirname(__FILE__) . '/LinkedInOAuth.php';
     }
     $api_config = array('appKey' => $params->get('api_key'), 'appSecret' => $params->get('api_secret'), 'callbackUrl' => NULL);
     $token_config = array('oauth_token' => $params->get('oauth_token'), 'oauth_token_secret' => $params->get('oauth_token_secret'));
     $linkedin = new LinkedInOAuth($api_config);
     $linkedin->setToken($token_config);
     $page_id = $params->get('linkedin_pageid');
     $response = $linkedin->getFollowersCount($page_id);
     $followers_count = 0;
     if ($response['success']) {
         $_xml = isset($response['linkedin']) ? $response['linkedin'] : '';
         if ($_xml != false && $_xml != '') {
             $_array = $linkedin->xmlToArray($_xml);
             $followers_count = isset($_array['company']['children']['num-followers']['content']) ? $_array['company']['children']['num-followers']['content'] : 0;
         }
     }
     return $followers_count;
 }