Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LinkedIn Company Feed

I am the owner and admin of a LinkedIn company page: https://www.linkedin.com/company/{id}/.

I want to connect to LinkedIn and get return a JSON-feed with latest 10 posts on my company wall to display on my website so I touch on the service https://api.linkedin.com/v1/companies/{id}/updates?format=json.

The JSON is outputted in linkedin.php. This file is then included in my web page, say index.php.

I have registrered an app at https://developer.linkedin.com. I have entered my Client ID and Client Secret in PHP-LinkedIn-SDK available here https://github.com/ashwinks/PHP-LinkedIn-SDK.

I followed the developer documentation I need to authenticate first. When I run linkedin.php I am redirected to sign into my LinkedIn profile. I have to finish this step in order to touch the service above.

With the current solution my users will have to login into LinkedIn when they access my website.

How can I access a list of my company's LinkedIn posts without prompting my users to sign in?

Thanks.

like image 564
user1965074 Avatar asked Oct 20 '22 05:10

user1965074


1 Answers

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,

like image 136
user3557613 Avatar answered Nov 02 '22 08:11

user3557613