• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP LinkedIn类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: HandleResponse

 function HandleResponse()
 {
     $config = (include "/config.php");
     $li = new LinkedIn(array('api_key' => $config['linkedin_client_id'], 'api_secret' => $config['linkedin_client_secret'], 'callback_url' => $config['domain'] . "/linkedin/login/success"));
     $token = $li->getAccessToken($_REQUEST['code']);
     $_SESSION['linkedin_token'] = $token;
     echo "<script>window.close();</script>";
     die;
 }
开发者ID:thinkingboxmedia,项目名称:ShareAPI,代码行数:9,代码来源:linkedin_verify.php


示例2: getUserIdFromApi

 protected function getUserIdFromApi()
 {
     // Create a LinkedIn object
     $linkedInApiConfig = array('appKey' => LI_API_KEY, 'appSecret' => LI_SECRET, 'callbackUrl' => APP_URL . '/' . Content::l() . '/login/linkedincallback/' . (!empty($_GET['nextPage']) ? $_GET['nextPage'] : ''));
     $linkedIn = new LinkedIn($linkedInApiConfig);
     try {
         $response = $linkedIn->retrieveTokenAccess($_GET['oauth_token'], $_SESSION['oauth']['linkedin']['request']['oauth_token_secret'], $_GET['oauth_verifier']);
     } catch (Error $e) {
         Debug::l('Error. Could not retrieve LinkedIn access token. ' . $e);
         header('Location: ' . APP_URL . '/' . Content::l() . '/login/linkedin/');
         exit;
     }
     if ($response['success'] === TRUE) {
         // The request went through without an error, gather user's access tokens
         $_SESSION['oauth']['linkedin']['access'] = $response['linkedin'];
         // Set the user as authorized for future quick reference
         $_SESSION['oauth']['linkedin']['authorized'] = true;
     } else {
         $this->exitWithMessage('Error. The OAuth access token was not retrieved. ' . print_r($response, 1));
     }
     $this->accessToken = serialize($response['linkedin']);
     /*
     Retrieve the user ID
     The XML response will look like one of these:
     
     <person>
       <id>8GhzNjjaOi</id>
     </person>
     
     <error>
       <status>401</status>
       <timestamp>1288518358054</timestamp>
       <error-code>0</error-code>
       <message>[unauthorized]. The token used in the OAuth request is not valid.</message>
     </error>
     */
     try {
         $response = $linkedIn->profile('~:(id,first-name,last-name)');
         if ($response['success'] === TRUE) {
             $response['linkedin'] = new SimpleXMLElement($response['linkedin']);
             if ($response['linkedin']->getName() != 'person') {
                 Debug::l('Error. Could not retrieve person data from LinkedIn. ' . print_r($response, 1));
                 header('Location: ' . APP_URL . '/' . Content::l() . '/login/linkedin/');
                 exit;
             }
         } else {
             Debug::l('Error. Could not retrieve person data from LinkedIn. ' . print_r($response, 1));
             header('Location: ' . APP_URL . '/' . Content::l() . '/login/linkedin/');
             exit;
         }
         $this->linkedInId = (string) $response['linkedin']->id;
         $this->name = $response['linkedin']->{'first-name'} . ' ' . $response['linkedin']->{'last-name'};
     } catch (Error $e) {
         Debug::l('Error. Could not retrieve person ID from LinkedIn. ' . $e);
         header('Location: ' . APP_URL . '/' . Content::l() . '/login/linkedin/');
         exit;
     }
 }
开发者ID:chitrakojha,项目名称:introduceme,代码行数:58,代码来源:LoginLinkedInCallback.php


示例3: testNET_API_LinkedIn

 function testNET_API_LinkedIn()
 {
     $LinkedIn = new LinkedIn();
     $res = $LinkedIn->Login('[email protected]', 'dfgsd');
     $this->assertTrue($res, "Can't login to LinkedIn");
     $Profile = $LinkedIn->GetProfileByID(8418679);
     //7202602);
     $this->assertTrue($Profile, "Can't get LinkedIn profile");
     $res = $Profile->GetPersonalDetails();
     $this->assertTrue($res && count($res), "Can't get LinkedIn personal details");
     $res = $Profile->GetInterests();
     $this->assertTrue($res, "Can't get LinkedIn interests");
     $res = $Profile->GetEmailAddress();
     $this->assertTrue($res, "Can't get LinkedIn email address");
     $res = $Profile->GetJobTitle();
     $this->assertTrue($res, "Can't get LinkedIn job title");
     $res = $Profile->GetExperience();
     $this->assertTrue($res, "Can't get LinkedIn experience block");
     $res = $Profile->GetEducation();
     $this->assertTrue($res, "Can't get LinkedIn education block");
     $connections = $LinkedIn->GetConnectionsList();
     $this->assertTrue(count($connections), "No connections found");
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:23,代码来源:tests.php


示例4: getData

 function getData()
 {
     $session = JFactory::getSession();
     $post = JRequest::get('post');
     $redsocialhelper = new redsocialhelper();
     $login = $redsocialhelper->getsettings();
     if (!isset($post['generatetoken'])) {
         return JText::_('PLEASE_SELECT_SECTION');
     }
     switch ($post['generatetoken']) {
         case 'facebook':
             $fb_profile_id = $session->set('fb_profile_id', $post['fb_profile_id']);
             $app_id = $login['app_id'];
             $app_secret = $login['app_secret'];
             require_once JPATH_SITE . '/components/com_redsocialstream/helpers/facebook/facebook.php';
             $redirect_url = urlencode(JURI::base() . "index.php?option=com_redsocialstream&view=access_token");
             header("location: https://www.facebook.com/dialog/oauth?client_id=" . $login['app_id'] . "&redirect_uri=" . $redirect_url . "&scope=manage_pages,publish_stream&manage_pages=1&publish_stream=1");
             break;
         case 'linkedin':
             //Linkedin APi Key
             $api_key = $login['linked_api_key'];
             //Linkedin Secret Key
             $secret_key = $login['linked_secret_key'];
             $redirect_url = JURI::base() . "index.php?option=com_redsocialstream&view=access_token";
             $linkedin_profile_id = $session->set('linkedin_profile_id', $post['linkedin_profile_id']);
             $API_CONFIG = array('appKey' => $api_key, 'appSecret' => $secret_key, 'callbackUrl' => $redirect_url);
             $linkedin = new LinkedIn($API_CONFIG);
             $response = $linkedin->retrieveTokenRequest();
             if ($response['success'] === TRUE) {
                 $session->set('oauthReqToken', $response['linkedin']);
                 // redirect the user to the LinkedIn authentication/authorisation page to initiate validation.
                 header('Location: ' . LINKEDIN::_URL_AUTH . $response['linkedin']['oauth_token']);
                 exit;
             }
             break;
     }
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:37,代码来源:accesstoken.php


示例5: demo

 public function demo()
 {
     session_start();
     $this->load->helper('url');
     $this->load->library('linkedin');
     $config['base_url'] = base_url('home/linkedin');
     $config['callback_url'] = base_url('home/demo');
     $config['linkedin_access'] = '75cmijp7gpecgv';
     $config['linkedin_secret'] = 'CkLc98T2vkqc4vEh';
     # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
     $linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url']);
     //$linkedin->debug = true;
     if (isset($_REQUEST['oauth_verifier'])) {
         $_SESSION['oauth_verifier'] = $_REQUEST['oauth_verifier'];
         $linkedin->request_token = unserialize($_SESSION['requestToken']);
         $linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
         $linkedin->getAccessToken($_REQUEST['oauth_verifier']);
         $_SESSION['oauth_access_token'] = serialize($linkedin->access_token);
         header("Location: " . $config['callback_url']);
         exit;
     } else {
         $linkedin->request_token = unserialize($_SESSION['requestToken']);
         $linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
         $linkedin->access_token = unserialize($_SESSION['oauth_access_token']);
     }
     # You now have a $linkedin->access_token and can make calls on behalf of the current member
     $xml_response = $linkedin->getProfile("~:(id,first-name,last-name,email-address,headline,picture-url)");
     /* echo '<pre>';
        echo 'My Profile Info';
        echo $xml_response;
        echo '<br />';
        echo '</pre>';*/
     $id = $linkedin->getProfile('~:(id)');
     $email = $linkedin->getProfile('~:(email-address)');
     $uid = trim(strip_tags($id));
     $email_address = trim(strip_tags($email));
     $response = $this->home->linkedinauth($email_address);
     if ($response == 1) {
         $this->home->set_online_status(1);
         if ($this->session->userdata('is_login')) {
             if ($this->session->userdata('is_alumni')) {
                 redirect(base_url('alumni'));
             } elseif ($this->session->userdata('is_prospective')) {
                 redirect(base_url('parents'));
             } else {
                 redirect(base_url('seeker'));
             }
         }
     } else {
         redirect(base_url('home'));
     }
     $this->data['view_file'] = 'index';
     echo Modules::run('template/home', $this->data);
 }
开发者ID:Entellus,项目名称:red,代码行数:54,代码来源:home_18.php


示例6: get_resume_data

 function get_resume_data()
 {
     $this->_check_auth();
     $API_CONFIG = $this->config->item('LINKEDIN_KEYS');
     $OBJ_linkedin = new LinkedIn($API_CONFIG);
     $OBJ_linkedin->setTokenAccess($this->session->userdata('access'));
     $OBJ_linkedin->setResponseFormat(LINKEDIN::_RESPONSE_JSON);
     $resumeResponse = $OBJ_linkedin->profile('~:(first-name,last-name,formatted-name,industry,skills,summary,specialties,positions,picture-url,educations,interests,headline,phone-numbers,email-address,member-url-resources)');
     if ($resumeResponse['success'] === TRUE) {
         $resumeData = json_decode($resumeResponse['linkedin'], true);
         //print_r($resumeData);
         $this->load->model('resume');
         $userId = $this->session->userdata('user_id');
         $resumeData = array();
         $resumeData['user_id'] = $userId;
         $resumeData['json_data'] = $resumeResponse['linkedin'];
         $resumeData['update_date'] = date('Y-m-d h:i:s');
         if (!$this->resume->exist($userId)) {
             $resumeData['create_date'] = date('Y-m-d h:i:s');
             $resumeId = $this->resume->create($resumeData);
         } else {
             $resumeId = $this->resume->update_user_id($userId, $resumeData);
         }
         redirect('/builder/customize/' . $resumeId, 'refresh');
     }
 }
开发者ID:njhamann,项目名称:LInkedIn-Resume-Generator,代码行数:26,代码来源:builder.php


示例7: getAPI

 protected function getAPI()
 {
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('linkedin');
     $OAuth2Token = $OAuth2->getToken();
     $API = new LinkedIn(array('appKey' => $OAuth2->appSettings['key'], 'appSecret' => $OAuth2->appSettings['secret'], 'callbackUrl' => null));
     $API->setTokenAccess(array('oauth_token' => $OAuth2Token->attribute('token'), 'oauth_token_secret' => $OAuth2Token->attribute('secret')));
     return $API;
 }
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:8,代码来源:linkedin.php


示例8: sfsi_getlinkedin_follower

 function sfsi_getlinkedin_follower($ln_company, $APIsettings)
 {
     require_once SFSI_DOCROOT . '/helpers/linkedin-api/linkedin-api.php';
     $url = 'http' . (empty($_SERVER['HTTPS']) ? '' : 's') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $linkedin = new LinkedIn($APIsettings['ln_api_key'], $APIsettings['ln_secret_key'], $APIsettings['ln_oAuth_user_token'], $url);
     $followers = $linkedin->getCompanyFollowersByName($ln_company);
     return strip_tags($followers);
 }
开发者ID:alextkd,项目名称:fdsmc,代码行数:8,代码来源:sfsi_socialhelper.php


示例9: sfsi_getlinkedin_follower

 function sfsi_getlinkedin_follower($ln_company, $APIsettings)
 {
     require_once SFSI_DOCROOT . '/helpers/linkedin-api/linkedin-api.php';
     $scheme = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https" : "http";
     $url = $scheme . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $linkedin = new LinkedIn($APIsettings['ln_api_key'], $APIsettings['ln_secret_key'], $APIsettings['ln_oAuth_user_token'], $url);
     $followers = $linkedin->getCompanyFollowersByName($ln_company);
     return strip_tags($followers);
 }
开发者ID:shazadmaved,项目名称:vizblog,代码行数:9,代码来源:sfsi_socialhelper.php


示例10: onSloginCheck

 public function onSloginCheck()
 {
     $redirect = JURI::base() . '?option=com_slogin&task=check&plugin=linkedin';
     $app = JFactory::getApplication();
     $input = $app->input;
     $oauth_problem = $input->getString('oauth_problem', '');
     if ($oauth_problem == 'user_refused') {
         $config = JComponentHelper::getParams('com_slogin');
         JModel::addIncludePath(JPATH_ROOT . '/components/com_slogin/models');
         $model = JModel::getInstance('Linking_user', 'SloginModel');
         $redirect = base64_decode($model->getReturnURL($config, 'failure_redirect'));
         $controller = JControllerLegacy::getInstance('SLogin');
         $controller->displayRedirect($redirect, true);
     }
     # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
     $linkedin = new LinkedIn($this->params->get('api_key'), $this->params->get('secret_key'), $redirect);
     //$linkedin->debug = true;
     $oauth_verifier = $input->getString('oauth_verifier', '');
     $requestToken = unserialize($app->getUserState('requestToken'));
     $linkedin->request_token = $requestToken;
     $linkedin->oauth_verifier = $app->getUserState('oauth_verifier');
     if (!empty($oauth_verifier)) {
         $app->setUserState('oauth_verifier', $oauth_verifier);
         $linkedin->getAccessToken($oauth_verifier);
         $app->setUserState('oauth_access_token', serialize($linkedin->access_token));
         header("Location: " . $redirect);
         exit;
     } else {
         $linkedin->access_token = unserialize($app->getUserState('oauth_access_token'));
     }
     # You now have a $linkedin->access_token and can make calls on behalf of the current member
     //$request = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url)");
     $request = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url,email-address)?format=json");
     $request = json_decode($request);
     if (empty($request)) {
         echo 'Error - empty user data';
         exit;
     } else {
         if (!empty($request->errorCode)) {
             echo 'Error - ' . $request->message;
             exit;
         }
     }
     $returnRequest = new SloginRequest();
     $returnRequest->first_name = $request->firstName;
     $returnRequest->last_name = $request->lastName;
     //            $returnRequest->email       = $request->email;
     $returnRequest->id = $request->id;
     $returnRequest->real_name = $request->firstName . ' ' . $request->lastName;
     $returnRequest->display_name = $request->firstName;
     $returnRequest->all_request = $request;
     return $returnRequest;
 }
开发者ID:gaetanodanelli,项目名称:slogin,代码行数:53,代码来源:linkedin.php


示例11: Share

 function Share()
 {
     $config = (include "/config.php");
     $li = new LinkedIn(array('api_key' => $config['linkedin_client_id'], 'api_secret' => $config['linkedin_client_secret'], 'callback_url' => $config['domain'] . "/linkedin/login/success"));
     $li->setAccessToken($_SESSION['linkedin_token']);
     $li->setState($_SESSION['linkedin_state']);
     $hasParams = false;
     $comment = "";
     $title = "";
     $description = "";
     $url = "";
     $source = "";
     $visiblity = "";
     if (isset($_POST['title']) && $_POST['title'] != "") {
         $hasParams = true;
         $title = $_POST['title'];
     }
     if (isset($_POST['description']) && $_POST['description'] != "") {
         $hasParams = true;
         $description = $_POST['description'];
     }
     if (isset($_POST['url']) && $_POST['url'] != "") {
         $hasParams = true;
         $url = $_POST['url'];
     }
     if (isset($_POST['source']) && $_POST['source'] != "") {
         $hasParams = true;
         $source = $_POST['source'];
     }
     if (isset($_POST['comment']) && $_POST['comment'] != "") {
         $comment = $_POST['comment'];
     }
     if (isset($_POST['visiblity']) && $_POST['visiblity'] != "") {
         $visiblity = $_POST['visiblity'];
     } else {
         $visiblity = "anyone";
     }
     if (!$hasParams) {
         return "Missing params";
         exit;
     }
     $post = array('comment' => $comment, 'content' => array('title' => $title, 'description' => $description, 'submitted_url' => $url, 'submitted_image_url' => $source), 'visibility' => array('code' => $visiblity));
     //echo $li->getAccessToken();
     try {
         $li->post('/people/~/shares', $post);
     } catch (Exception $ex) {
         return $ex->getMessage();
     }
     return 'success';
 }
开发者ID:thinkingboxmedia,项目名称:ShareAPI,代码行数:50,代码来源:linkedin_share.php


示例12: _startLinkedinHandshake

 private function _startLinkedinHandshake($req_type, $credentials)
 {
     $session = self::oauth_session_exists();
     $app = JFactory::getApplication();
     require_once dirname(__FILE__) . DS . 'jobboard' . DS . 'lib' . DS . 'linkedin' . DS . 'linkedin_3.1.1.class.php';
     $API_CONFIG = array('appKey' => $credentials['key'], 'appSecret' => $credentials['secret'], 'callbackUrl' => null);
     switch ($req_type) {
         case 'initiate':
             $API_CONFIG['callbackUrl'] = JURI::root() . 'index.php?option=com_jobboard&view=user&task=getlinkedinprof&' . $req_type . '=initiate&' . LINKEDIN::_GET_RESPONSE . '=1&Itemid=' . $this->_itemid;
             $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 = $session->get('oauth');
                     $session_oauth['oauth']['linkedin']['request'] = $response['linkedin'];
                     $session->set('oauth', $session_oauth);
                     $app->redirect(LINKEDIN::_URL_AUTH . $response['linkedin']['oauth_token']);
                 } else {
                     $msg = JText::_('PLG_JOBBOARD_REQUEST_TOKEN_RETRIEVAL_FAILED');
                     $app->redirect('index.php?option=com_jobboard&view=user&task=addcv&Itemid=' . $this->_itemid, $msg, 'error');
                 }
             } else {
                 self::_processResponse(&$OBJ_linkedin);
             }
             return self::_getLinkedInProfile(&$OBJ_linkedin);
             break;
         case 'revoke':
             $session_oauth = $session->get('oauth');
             $OBJ_linkedin = new LinkedIn($API_CONFIG);
             $OBJ_linkedin->setTokenAccess($session_oauth['oauth']['linkedin']['access']);
             $response = $OBJ_linkedin->revoke();
             if ($response['success'] === TRUE) {
                 if ($session->clear('oauth')) {
                     $msg = JText::_('PLG_JOBBOARD_AUTH_REVOKE_SUCCESS');
                     $msg_type = 'Message';
                 } else {
                     $msg = JText::_('PLG_JOBBOARD_SESSION_CLEAR_FAILED');
                     $msg_type = 'error';
                 }
             } else {
                 $msg = JText::_('PLG_JOBBOARD_AUTH_REVOKE_FAILED');
                 $msg_type = 'error';
             }
             $app->redirect('index.php?option=com_jobboard&view=user&task=addcv&Itemid=' . $this->_itemid, $msg, $msg_type);
             break;
         default:
             break;
     }
 }
开发者ID:Rayvid,项目名称:joomla-jobboard,代码行数:50,代码来源:jobboard.php


示例13: loadProfiles

 private function loadProfiles($person, $personIsUser)
 {
     $profiles = array();
     if (!empty($person['facebook_access_token']) && (!$personIsUser || $this->mergeNetwork != 'Facebook')) {
         try {
             //$params = array('access_token' => $user['facebook_access_token']);
             $facebookProfile = SessionManager::getInstance()->getFacebook()->api('/' . $person['facebook_id']);
         } catch (FacebookApiException $e) {
             Debug::l('Error loading Facebook profile for ' . ($personIsUser ? 'current' : 'other') . ' user. ' . $e);
         }
         if (isset($facebookProfile)) {
             $profiles[] = '<a href="' . $facebookProfile['link'] . '" target="_blank" class="profile"><img src="https://graph.facebook.com/' . $person['facebook_id'] . '/picture?type=square" /> ' . $facebookProfile['name'] . ' on Facebook</a>';
         }
     }
     if (!empty($person['linkedin_access_token']) && (!$personIsUser || $this->mergeNetwork != 'LinkedIn')) {
         $API_CONFIG = array('appKey' => LI_API_KEY, 'appSecret' => LI_SECRET, 'callbackUrl' => '');
         $OBJ_linkedin = new LinkedIn($API_CONFIG);
         $OBJ_linkedin->setTokenAccess(unserialize($person['linkedin_access_token']));
         try {
             $linkedInProfile = $OBJ_linkedin->profile('id=' . $person['linkedin_id'] . ':(first-name,last-name,public-profile-url,picture-url)');
         } catch (ErrorException $e) {
             Debug::l('Error loading LinkedIn profile for ' . ($personIsUser ? 'current' : 'other') . ' user. ' . $e);
         }
         if ($linkedInProfile['success'] === TRUE) {
             $linkedInProfile['linkedin'] = new SimpleXMLElement($linkedInProfile['linkedin']);
             if ($linkedInProfile['linkedin']->getName() == 'person') {
                 $li_pr = (string) $linkedInProfile['linkedin']->{'public-profile-url'};
                 $li_pi = (string) $linkedInProfile['linkedin']->{'picture-url'};
                 $li_fn = (string) $linkedInProfile['linkedin']->{'first-name'};
                 $li_ln = (string) $linkedInProfile['linkedin']->{'last-name'};
                 $profiles[] = '<a href="' . $li_pr . '" target="_blank" class="profile"><img src="' . $li_pi . '" /> ' . $li_fn . ' ' . $li_ln . ' on LinkedIn</a>';
             }
         }
     }
     if (!empty($person['twitter_access_token']) && ($personIsUser || $this->mergeNetwork != 'Twitter')) {
         try {
             $twitterAccessToken = unserialize($person['twitter_access_token']);
             $twitter = new TwitterOAuth(TW_CONSUMER, TW_SECRET, $twitterAccessToken['oauth_token'], $twitterAccessToken['oauth_token_secret']);
             $twitter->format = 'json';
             $twitterProfile = $twitter->get('users/show', array('user_id' => $person['twitter_id']));
         } catch (ErrorException $e) {
             Debug::l('Error loading Twitter profile for ' . ($personIsUser ? 'current' : 'other') . ' user. ' . $e);
         }
         if (isset($twitterProfile)) {
             $profiles[] = '<a href="http://twitter.com/' . $twitterProfile->screen_name . '" target="_blank" class="profile"><img src="' . $twitterProfile->profile_image_url . '" /> @' . $twitterProfile->screen_name . ' on Twitter</a>';
         }
     }
     return $profiles;
 }
开发者ID:chitrakojha,项目名称:introduceme,代码行数:49,代码来源:PageMergeAccounts.php


示例14: linkedinGetLoggedinUserInfo

 public function linkedinGetLoggedinUserInfo($requestToken = '', $oauthVerifier = '', $accessToken = '')
 {
     include_once $this->config['linkedin_library_path'];
     $linkedin = new LinkedIn($this->config['linkedin_access'], $this->config['linkedin_secret']);
     $linkedin->request_token = unserialize($requestToken);
     //as data is passed here serialized form
     $linkedin->oauth_verifier = $oauthVerifier;
     $linkedin->access_token = unserialize($accessToken);
     try {
         $xml_response = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url,public-profile-url)");
     } catch (Exception $o) {
         print_r($o);
     }
     return $xml_response;
 }
开发者ID:BGCX067,项目名称:facebook-twitter-linkedin-status-update-svn-to-git,代码行数:15,代码来源:class.fblinkedtwit.php


示例15: linkedInStatus

 public function linkedInStatus($status, $requestToken = '', $oauthVerifier = '', $accessToken = '')
 {
     include_once 'linkedinoAuth.php';
     $linkedin = new LinkedIn($this->config['linkedin_access'], $this->config['linkedin_secret']);
     $linkedin->request_token = unserialize($requestToken);
     //as data is passed here serialized form
     $linkedin->oauth_verifier = $oauthVerifier;
     $linkedin->access_token = unserialize($accessToken);
     try {
         $xml_response = $linkedin->setStatus($status);
     } catch (Exception $o) {
         print_r($o);
     }
     return $xml_response;
 }
开发者ID:neevan1e,项目名称:Done,代码行数:15,代码来源:class.linkedClass.php


示例16: getUserActivity

 /**
  * load the user latest activity
  *    - timeline : all the stream
  *    - me       : the user activity only
  * {@inheritdoc}
  */
 function getUserActivity($stream)
 {
     try {
         if ($stream == "me") {
             $response = $this->api->updates('?type=SHAR&scope=self&count=25');
         } else {
             $response = $this->api->updates('?type=SHAR&count=25');
         }
     } catch (LinkedInException $e) {
         throw new Exception("User activity stream request failed! {$this->providerId} returned an error: {$e}");
     }
     if (!$response || !$response['success']) {
         return array();
     }
     $updates = new SimpleXMLElement($response['linkedin']);
     $activities = array();
     foreach ($updates->update as $update) {
         $person = $update->{'update-content'}->person;
         $share = $update->{'update-content'}->person->{'current-share'};
         $ua = new Hybrid_User_Activity();
         $ua->id = (string) $update->id;
         $ua->date = (string) $update->timestamp;
         $ua->text = (string) $share->{'comment'};
         $ua->user->identifier = (string) $person->id;
         $ua->user->displayName = (string) $person->{'first-name'} . ' ' . $person->{'last-name'};
         $ua->user->profileURL = (string) $person->{'site-standard-profile-request'}->url;
         $ua->user->photoURL = null;
         $activities[] = $ua;
     }
     return $activities;
 }
开发者ID:nullziu,项目名称:hybridauth,代码行数:37,代码来源:LinkedIn.php


示例17: __construct

 public function __construct()
 {
     session_start();
     // Create a LinkedIn object
     $linkedInApiConfig = array('appKey' => LI_API_KEY, 'appSecret' => LI_SECRET, 'callbackUrl' => APP_URL . '/' . Content::l() . '/login/linkedincallback/' . (!empty($_GET['nextPage']) ? $_GET['nextPage'] : ''));
     $linkedIn = new LinkedIn($linkedInApiConfig);
     // Send a request for a LinkedIn access token
     $response = $linkedIn->retrieveTokenRequest();
     if ($response['success'] === TRUE) {
         // Split up the response and stick the LinkedIn portion in the user session
         $_SESSION['oauth']['linkedin']['request'] = $response['linkedin'];
         // Redirect the user to the LinkedIn authentication/authorisation page to initiate validation.
         header('Location: ' . LINKEDIN::_URL_AUTH . $_SESSION['oauth']['linkedin']['request']['oauth_token']);
     } else {
         $this->exitWithMessage('Unable to retrieve access token for LinkedIn');
     }
 }
开发者ID:chitrakojha,项目名称:introduceme,代码行数:17,代码来源:LoginLinkedIn.php


示例18: GetUserInfo

 function GetUserInfo()
 {
     //Comma seperated list of fields you wish returned
     // https://developer.linkedin.com/docs/fields/basic-profile
     if (!isset($_GET['fields']) || $_GET['fields'] == "") {
         return "Missing required params";
         exit;
     }
     $config = (include "/config.php");
     $li = new LinkedIn(array('api_key' => $config['linkedin_client_id'], 'api_secret' => $config['linkedin_client_secret'], 'callback_url' => $config['domain'] . "/linkedin/login/success"));
     $li->setAccessToken($_SESSION['linkedin_token']);
     try {
         $info = $li->get('/people/~:(' . $_GET['fields'] . ')');
     } catch (Exception $ex) {
         return $ex->getMessage();
     }
     return $info;
 }
开发者ID:thinkingboxmedia,项目名称:ShareAPI,代码行数:18,代码来源:linkedin_user.php


示例19: LinkedInException

     */
    if (!array_key_exists('signature_version', $credentials) || $credentials['signature_version'] != 1) {
        // invalid/missing signature_version
        throw new LinkedInException('Invalid/missing signature_version in passed credentials - ' . print_r($credentials, TRUE));
    }
    if (!array_key_exists('signature_order', $credentials) || !is_array($credentials['signature_order'])) {
        // invalid/missing signature_order
        throw new LinkedInException('Invalid/missing signature_order in passed credentials - ' . print_r($credentials, TRUE));
    }
    // calculate base signature
    $sig_order = $credentials['signature_order'];
    $sig_base = '';
    foreach ($sig_order as $sig_element) {
        $sig_base .= $credentials[$sig_element];
    }
    // calculate encrypted signature
    $sig_encrypted = base64_encode(hash_hmac('sha1', $sig_base, $API_CONFIG['appSecret'], TRUE));
    // finally, check token validity
    if (!array_key_exists('signature', $credentials) || $sig_encrypted != $credentials['signature']) {
        // invalid/missing signature
        throw new LinkedInException('Invalid/missing signature in credentials - ' . print_r($credentials, TRUE));
    }
    // swap tokens
    $OBJ_linkedin = new LinkedIn($API_CONFIG);
    $response = $OBJ_linkedin->exchangeToken($credentials['access_token']);
    // echo out response
    echo '<pre>' . print_r($response['linkedin'], TRUE) . '</pre>';
} catch (LinkedInException $e) {
    // exception raised
    echo $e->getMessage();
}
开发者ID:VarunTalik,项目名称:simple-linkedinphp,代码行数:31,代码来源:tokenExchange.php


示例20: session_start

$linkedin_access = $config_params['linkedin_access'];
$linkedin_secret = $config_params['linkedin_secret'];
//$sess = new SessionManager();
session_start();
$config['base_url'] = "{$hostname}/linkedin/page1.php";
$config['callback_url'] = "{$hostname}/linkedin/page2.php";
// $config['linkedin_access']      =   'YMKaHlPF6xv8YTMs_FftnoC1tq_0Fgoz9Y8me0PvcR1Sm9WxzuPI18hZr2yP3fFq';//twetest
// $config['linkedin_secret']      =   'PuKdmBOQFdR1vibAe0LX3yRkKhu-NWlZaqC3EwnsiiMw1OL0EZ_J_rmh5PjzHXfg';//twetest
$config['linkedin_access'] = $linkedin_access;
//twetest
$config['linkedin_secret'] = $linkedin_secret;
//twetest
include_once $docroot . "/linkedin/linkedin.php";
logger("Ln/Page2: Top");
# First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
$linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url']);
//$linkedin->debug = true;
if (isset($_REQUEST['oauth_verifier'])) {
    $_SESSION['oauth_verifier'] = $_REQUEST['oauth_verifier'];
    $linkedin->request_token = unserialize($_SESSION['requestToken']);
    $linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
    $linkedin->getAccessToken($_REQUEST['oauth_verifier']);
    logger("Ln/Page2: access token1: ", $linkedin->access_token);
    $_SESSION['oauth_access_token'] = serialize($linkedin->access_token);
    header("Location: " . $config['callback_url']);
    exit;
} else {
    $linkedin->request_token = unserialize($_SESSION['requestToken']);
    $linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
    $linkedin->access_token = unserialize($_SESSION['oauth_access_token']);
    logger("Ln/Page2: access token2: ", $linkedin->access_token);
开发者ID:raj4126,项目名称:twextra,代码行数:31,代码来源:page2.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Linker类代码示例发布时间:2022-05-23
下一篇:
PHP LinkCache类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap