当前位置: 首页>>代码示例>>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;未经允许,请勿转载。