當前位置: 首頁>>代碼示例>>PHP>>正文


PHP LinkedIn::setAccessToken方法代碼示例

本文整理匯總了PHP中LinkedIn::setAccessToken方法的典型用法代碼示例。如果您正苦於以下問題:PHP LinkedIn::setAccessToken方法的具體用法?PHP LinkedIn::setAccessToken怎麽用?PHP LinkedIn::setAccessToken使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在LinkedIn的用法示例。


在下文中一共展示了LinkedIn::setAccessToken方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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


注:本文中的LinkedIn::setAccessToken方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。