LinkedIn Company Feed

自作多情 提交于 2019-12-04 07:39:20

1. Generate your access token Follow the documentation https://github.com/ashwinks/PHP-LinkedIn-SDK to create a login link.

2. Save your access token Once you get it, it will be available for 60 days. Save it into your database.

3. Fetch your company posts You can use the same access token to fetch company contents

$li = new LinkedIn(...);
$li->setAccessToken(YOUR_ACCESS_TOKEN);
$posts = $li->get('/companies/YOUR_COMPANY_ID/updates/');

4. Manage response Cache or display the response after parsing it.

Hope that helps,

Use https://packagist.org/packages/linkedinapi/linkedin

$li = new LinkedIn(
  array(
    'api_key' => 'yourapikey', 
    'api_secret' => 'yourapisecret', 
    'callback_url' => 'https://yourdomain.com/redirecthere'
  )
);



//Get the login URL - this accepts an array of SCOPES




$url = $li->getLoginUrl(
  array(
    LinkedIn::SCOPE_BASIC_PROFILE, 
    LinkedIn::SCOPE_EMAIL_ADDRESS, 
    LinkedIn::SCOPE_NETWORK
  )
);



/*LinkedIn will redirect to 'callback_url' with an access token as the 'code' parameter. You might want to store the token in your session so the user doesn't have to log in again*/


$token = $li->getAccessToken($_REQUEST['code']);
$token_expires = $li->getAccessTokenExpiration();
//Make a request to the API




$info = $li->get('/people/~:(first-name,last-name,positions)');



$li = new LinkedIn(
  array(
    'api_key' => 'yourapikey', 
    'api_secret' => 'yourapisecret', 
    'callback_url' => 'https://yourdomain.com/redirecthere',
    'curl_options' => array(
        CURLOPT_PROXY => '127.0.0.1:80',
    ),
  )
)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!