Feedback

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

.

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

.

JSON is output to linkedin.php

. This file is then included in my web page, say index.php

.

I registered my app at https://developer.linkedin.com . I have entered my client ID and client secret in the PHP-LinkedIn-SDK, which is available here https://github.com/ashwinks/PHP-LinkedIn-SDK .

I followed the developer documentation I need to check first. When I launch linkedin.php

, I am redirected to log into my LinkedIn profile. I have to finish this step to touch the service above.

In the current solution, my users will have to connect to LinkedIn when they access my site.

How can I access my list of posts on my LinkedIn company without asking my users to sign in?

Thank.

+3


source to share


1 answer


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

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

3. Get messages about your company You can use the same access token to get company content



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

      

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

Hope it helps,

+1


source







All Articles