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


PHP LinkedIn::getApplicationKey方法代码示例

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


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

示例1: SimpleXMLElement

" id="<?php 
                echo LINKEDIN::_GET_TYPE;
                ?>
" value="revoke" />
              <input type="submit" value="Revoke Authorization" />
            </form>
            
            <hr />
          
            <h2 id="application">Application Information:</h2>
            
            <ul>
              <li>Application Key: 
                <ul>
                  <li><pre><?php 
                echo $OBJ_linkedin->getApplicationKey();
                ?>
</pre></li>
                </ul>
              </li>
            </ul>
            
            <hr />
            
            <h2 id="profile">Your Profile:</h2>
            
            <?php 
                $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>";
开发者ID:VarunTalik,项目名称:simple-linkedinphp,代码行数:31,代码来源:index.php

示例2: test


//.........这里部分代码省略.........
                  */
                 // check for the correct http protocol (i.e. is this script being served via http or https)
                 if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
                     $protocol = 'https';
                 } else {
                     $protocol = 'http';
                 }
                 // set the callback url
                 $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);
                 // check for response from LinkedIn
                 $_GET[LINKEDIN::_GET_RESPONSE] = isset($_GET[LINKEDIN::_GET_RESPONSE]) ? $_GET[LINKEDIN::_GET_RESPONSE] : '';
                 if (!$_GET[LINKEDIN::_GET_RESPONSE]) {
                     // LinkedIn hasn't sent us a response, the user is initiating the connection
                     // send a request for a LinkedIn access token
                     $response = $OBJ_linkedin->retrieveTokenRequest();
                     if ($response['success'] === TRUE) {
                         // store the request token
                         $_SESSION['oauth']['linkedin']['request'] = $response['linkedin'];
                         // redirect the user to the LinkedIn authentication/authorisation page to initiate validation.
                         header('Location: ' . LINKEDIN::_URL_AUTH . $response['linkedin']['oauth_token']);
                     } else {
                         // bad token request
                         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 {
                     // LinkedIn has sent a response, user has granted permission, take the temp access token, the user's secret and the verifier to request the user's real secret key
                     $response = $OBJ_linkedin->retrieveTokenAccess($_SESSION['oauth']['linkedin']['request']['oauth_token'], $_SESSION['oauth']['linkedin']['request']['oauth_token_secret'], $_GET['oauth_verifier']);
                     if ($response['success'] === TRUE) {
                         // the request went through without an error, gather user's 'access' tokens
                         $_SESSION['oauth']['linkedin']['access'] = $response['linkedin'];
                         $this->data['success'] = TRUE;
                         $this->data['status'] = TRUE;
                         $response['linkedin'] = new SimpleXMLElement($response['linkedin']);
                         // set the user as authorized for future quick reference
                         $_SESSION['oauth']['linkedin']['authorized'] = TRUE;
                         // redirect the user back to the demo page
                         header('Location: ' . $_SERVER['PHP_SELF']);
                     } else {
                         // bad token access
                         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;
             default:
                 // nothing being passed back, display demo page
                 // check PHP version
                 if (version_compare(PHP_VERSION, '5.0.0', '<')) {
                     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);
                 } else {
                 }
                 if ($_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
                     // user is already connected
                     $application_key = $OBJ_linkedin->getApplicationKey();
                     $this->data['success'] = FALSE;
                     $response = $OBJ_linkedin->profile('~:(id,first-name,last-name,picture-url)');
                     $this->data['response'] = $response;
                     if ($response['success'] === TRUE) {
                         $this->data['success'] = TRUE;
                         $this->data['status'] = TRUE;
                         $response['linkedin'] = new SimpleXMLElement($response['linkedin']);
                         //var_dump($response['linkedin']);
                         $this->data['response'] = $response['linkedin'];
                     } else {
                         $this->data['status'] = FALSE;
                         // request failed
                     }
                 } else {
                     // user isn't connected
                 }
                 break;
         }
     } catch (LinkedInException $e) {
         // exception raised by library call
         $e->getMessage();
     }
     $this->data['invitation_key'] = array('name' => 'invitation_key', 'id' => 'invitation_key', 'value' => $this->data['invitation_key_val'], 'type' => 'hidden');
     $this->data['first_name'] = array('name' => 'first_name', 'id' => 'first_name', 'type' => 'text', 'value' => $this->form_validation->set_value('first_name'), 'placeholder' => 'First Name', 'required' => 'required');
     $this->data['last_name'] = array('name' => 'last_name', 'id' => 'last_name', 'type' => 'text', 'value' => $this->form_validation->set_value('last_name'), 'placeholder' => 'Last Name', 'required' => 'required');
     $this->data['email'] = array('name' => 'email', 'id' => 'email', 'type' => 'text', 'value' => $this->data['email_val'], 'placeholder' => 'Email', 'required' => 'required', 'readonly' => 'readonly');
     $this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password', 'value' => $this->form_validation->set_value('password'), 'placeholder' => 'Password', 'required' => 'required');
     $this->data['password_confirm'] = array('name' => 'password_confirm', 'id' => 'password_confirm', 'type' => 'password', 'value' => $this->form_validation->set_value('password_confirm'), 'placeholder' => 'Confirm Password', 'required' => 'required');
     // Render View
     //$this->load->view('auth/create_user', $this->data);
     $this->data['main_content'] = '/auth/signup';
     $this->load->view('includes/tmpl_singlebox', $this->data);
 }
开发者ID:laiello,项目名称:skrapshcnul,代码行数:101,代码来源:auth.php


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