当前位置: 首页>>代码示例>>PHP>>正文


PHP LinkedIn::group方法代码示例

本文整理汇总了PHP中LinkedIn::group方法的典型用法代码示例。如果您正苦于以下问题:PHP LinkedIn::group方法的具体用法?PHP LinkedIn::group怎么用?PHP LinkedIn::group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinkedIn的用法示例。


在下文中一共展示了LinkedIn::group方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: LinkedInException

                throw new LinkedInException('You must be running version 5.x or greater of PHP to use this library.');
            }
            // check for cURL
            if (extension_loaded('curl')) {
                $curl_version = curl_version();
                $curl_version = $curl_version['version'];
            } else {
                throw new LinkedInException('You must load the cURL extension to use this library.');
            }
            $_SESSION['oauth']['linkedin']['authorized'] = isset($_SESSION['oauth']['linkedin']['authorized']) ? $_SESSION['oauth']['linkedin']['authorized'] : FALSE;
            if ($_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
                $OBJ_linkedin = new LinkedIn($API_CONFIG);
                $OBJ_linkedin->setTokenAccess($_SESSION['oauth']['linkedin']['access']);
                $OBJ_linkedin->setResponseFormat(LINKEDIN::_RESPONSE_XML);
                // check if the viewer is a member of the test group
                $response = $OBJ_linkedin->group(DEMO_GROUP, ':(relation-to-viewer:(membership-state))');
                if ($response['success'] === TRUE) {
                    $result = new SimpleXMLElement($response['linkedin']);
                    $membership = $result->{'relation-to-viewer'}->{'membership-state'}->code;
                    $in_demo_group = $membership == 'non-member' || $membership == 'blocked' ? FALSE : TRUE;
                } else {
                    // request failed
                    echo "Error retrieving group membership information: <br /><br />RESPONSE:<br /><br /><pre>" . print_r($response, TRUE) . "</pre>";
                }
                ?>
            </ul>
            <?php 
            } else {
            }
            ?>
开发者ID:praveenpgoswami,项目名称:codeigniter_project,代码行数:30,代码来源:demo.php

示例2: linkedin

 public function linkedin()
 {
     try {
         $API_CONFIG = array('appKey' => '75wpz389ifrzbq', 'appSecret' => 'ZYEG6gBlFhhUAkfR', 'callbackUrl' => NULL);
         define('DEMO_GROUP', '4010474');
         define('DEMO_GROUP_NAME', 'Simple LI Demo');
         define('PORT_HTTP', '80');
         define('PORT_HTTP_SSL', '443');
         $_GET['lType'] = isset($_GET['lType']) ? $_GET['lType'] : '';
         switch ($_GET['lType']) {
             case 'initiate':
                 if ($_SERVER['HTTPS'] == 'on') {
                     $protocol = 'https';
                 } else {
                     $protocol = 'http';
                 }
                 $API_CONFIG['callbackUrl'] = $protocol . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != PORT_HTTP || $_SERVER['SERVER_PORT'] != PORT_HTTP_SSL ? ':' . $_SERVER['SERVER_PORT'] : '') . $_SERVER['PHP_SELF'] . '?' . LINKEDIN::_GET_TYPE . '=initiate&' . LINKEDIN::_GET_RESPONSE . '=1';
                 $OBJ_linkedin = new LinkedIn($API_CONFIG);
                 $_GET[LINKEDIN::_GET_RESPONSE] = isset($_GET[LINKEDIN::_GET_RESPONSE]) ? $_GET[LINKEDIN::_GET_RESPONSE] : '';
                 if (!$_GET[LINKEDIN::_GET_RESPONSE]) {
                     $response = $OBJ_linkedin->retrieveTokenRequest();
                     if ($response['success'] === TRUE) {
                         $_SESSION['oauth']['linkedin']['request'] = $response['linkedin'];
                         header('Location: ' . LINKEDIN::_URL_AUTH . $response['linkedin']['oauth_token']);
                     } else {
                         echo "Request token retrieval failed:<br /><br />RESPONSE:<br /><br /><pre>" . print_r($response, TRUE) . "</pre><br /><br />LINKEDIN OBJ:<br /><br /><pre>" . print_r($OBJ_linkedin, TRUE) . "</pre>";
                     }
                 } else {
                     $response = $OBJ_linkedin->retrieveTokenAccess($_SESSION['oauth']['linkedin']['request']['oauth_token'], $_SESSION['oauth']['linkedin']['request']['oauth_token_secret'], $_GET['oauth_verifier']);
                     if ($response['success'] === TRUE) {
                         $_SESSION['oauth']['linkedin']['access'] = $response['linkedin'];
                         $_SESSION['oauth']['linkedin']['authorized'] = TRUE;
                         header('Location: ' . $_SERVER['PHP_SELF']);
                     } else {
                         echo "Access token retrieval failed:<br /><br />RESPONSE:<br /><br /><pre>" . print_r($response, TRUE) . "</pre><br /><br />LINKEDIN OBJ:<br /><br /><pre>" . print_r($OBJ_linkedin, TRUE) . "</pre>";
                     }
                 }
                 break;
             case 'revoke':
                 if (!oauth_session_exists()) {
                     throw new LinkedInException('This script requires session support, which doesn\'t appear to be working correctly.');
                 }
                 $OBJ_linkedin = new LinkedIn($API_CONFIG);
                 $OBJ_linkedin->setTokenAccess($_SESSION['oauth']['linkedin']['access']);
                 $response = $OBJ_linkedin->revoke();
                 if ($response['success'] === TRUE) {
                     session_unset();
                     $_SESSION = array();
                     if (session_destroy()) {
                         header('Location: ' . $_SERVER['PHP_SELF']);
                     } else {
                         echo "Error clearing user's session";
                     }
                 } else {
                     echo "Error revoking user's token:<br /><br />RESPONSE:<br /><br /><pre>" . print_r($response, TRUE) . "</pre><br /><br />LINKEDIN OBJ:<br /><br /><pre>" . print_r($OBJ_linkedin, TRUE) . "</pre>";
                 }
                 break;
             default:
                 $_SESSION['oauth']['linkedin']['authorized'] = isset($_SESSION['oauth']['linkedin']['authorized']) ? $_SESSION['oauth']['linkedin']['authorized'] : FALSE;
                 if ($_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
                     $OBJ_linkedin = new LinkedIn($API_CONFIG);
                     $OBJ_linkedin->setTokenAccess($_SESSION['oauth']['linkedin']['access']);
                     $OBJ_linkedin->setResponseFormat(LINKEDIN::_RESPONSE_XML);
                     $response = $OBJ_linkedin->group(DEMO_GROUP, ':(relation-to-viewer:(membership-state))');
                     if ($response['success'] === TRUE) {
                         $result = new SimpleXMLElement($response['linkedin']);
                         $membership = $result->{'relation-to-viewer'}->{'membership-state'}->code;
                         $in_demo_group = $membership == 'non-member' || $membership == 'blocked' ? FALSE : TRUE;
                     } else {
                         echo "Error retrieving group membership information: <br /><br />RESPONSE:<br /><br /><pre>" . print_r($response, TRUE) . "</pre>";
                     }
                 } else {
                 }
                 if ($_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
                     $response = $OBJ_linkedin->profile('~:(id,first-name,last-name,picture-url)');
                     if ($response['success'] === TRUE) {
                         $response['linkedin'] = new SimpleXMLElement($response['linkedin']);
                         echo "<pre>" . print_r($response['linkedin'], TRUE) . "</pre>";
                     } else {
                         echo "Error retrieving profile information:<br /><br />RESPONSE:<br /><br /><pre>" . print_r($response) . "</pre>";
                     }
                 } else {
                 }
                 break;
         }
     } catch (LinkedInException $e) {
         echo $e->getMessage();
     }
     $this->setErrorMessage('success', 'Registered & Login Successfully');
 }
开发者ID:praveenpgoswami,项目名称:codeigniter_project,代码行数:90,代码来源:user.php

示例3: isset

          
          <ul>
            <li>Please note: The Simple-LinkedIn class requires PHP 5+</li>
          </ul>
          
          <hr />
          
          <?php 
            $_SESSION['oauth']['linkedin']['authorized'] = isset($_SESSION['oauth']['linkedin']['authorized']) ? $_SESSION['oauth']['linkedin']['authorized'] : FALSE;
            if ($_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
                // user is already connected
                $OBJ_linkedin = new LinkedIn($API_CONFIG);
                $OBJ_linkedin->setTokenAccess($_SESSION['oauth']['linkedin']['access']);
                $OBJ_linkedin->setResponseFormat(LINKEDIN::_RESPONSE_XML);
                // check if the viewer is a member of the test group
                $response = $OBJ_linkedin->group(DEMO_GROUP, ':(relation-to-viewer:(membership-state))');
                if ($response['success'] === TRUE) {
                    $result = new SimpleXMLElement($response['linkedin']);
                    $membership = $result->{'relation-to-viewer'}->{'membership-state'}->code;
                    $in_demo_group = $membership == 'non-member' || $membership == 'blocked' ? FALSE : TRUE;
                    ?>
	            <ul>
	              <li><a href="#manage">Manage LinkedIn Authorization</a></li>
	              <li><a href="../demo.php#application">Application Information</a></li>
	              <li><a href="../demo.php#profile">Your Profile</a></li>
	              <li><a href="#groups">Groups API</a>
	                <ul>
	                  <li><a href="#groupMemberships">Group Memberships</a></li>
	                  <li><a href="#groupsSuggested">Suggested Groups</a></li>
                    <li><a href="#manageGroup">Manage '<?php 
                    echo DEMO_GROUP_NAME;
开发者ID:VarunTalik,项目名称:simple-linkedinphp,代码行数:30,代码来源:groups.php

示例4: linkedin_old

 public static function linkedin_old()
 {
     $id = ESSBSocialFansCounterHelper::get_option('linkedin.id');
     $account_type = ESSBSocialFansCounterHelper::get_option('linkedin.account_type', 'company');
     $app_key = ESSBSocialFansCounterHelper::get_option('linkedin.app_key');
     $app_secret = ESSBSocialFansCounterHelper::get_option('linkedin.app_secret');
     $oauth_token = ESSBSocialFansCounterHelper::get_option('linkedin.oauth_token');
     $oauth_token_secret = ESSBSocialFansCounterHelper::get_option('linkedin.oauth_token_secret');
     if (empty($id) || empty($app_secret) || empty($app_key) || $account_type == 'profile' && (empty($oauth_token) || empty($oauth_token_secret))) {
         return 0;
     }
     $opt = array('appKey' => $app_key, 'appSecret' => $app_secret, 'callbackUrl' => '');
     $api = new LinkedIn($opt);
     if ($account_type == 'company') {
         $response = $api->company(trim('universal-name=' . $id . ':(num-followers)'));
     } elseif ($account_type == 'group') {
         $response = $api->group($id, ':(num-members)');
     } else {
         $api->setTokenAccess(array('oauth_token' => $oauth_token, 'oauth_token_secret' => $oauth_token_secret));
         $response = $api->statistics($id);
     }
     if (false == $response['success']) {
         return false;
     }
     $xml = new SimpleXMLElement($response['linkedin']);
     $count = 0;
     if ($account_type == 'company') {
         if (isset($xml->{'num-followers'})) {
             $count = current($xml->{'num-followers'});
         }
     }
     if ($account_type == 'group') {
         if (isset($xml->{'num-members'})) {
             $count = current($xml->{'num-members'});
         }
     }
     if ($account_type == 'profile') {
         if (isset($xml->property)) {
             $count = (string) $xml->property[0];
         }
     }
     return $count;
 }
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:43,代码来源:essb-social-fanscounter-updater.php


注:本文中的LinkedIn::group方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。