PHP code example of matthewmee1 / linkedin-api-php-client
1. Go to this page and download the library: Download matthewmee1/linkedin-api-php-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
matthewmee1 / linkedin-api-php-client example snippets
// ... please, add composer autoloader first
// instantiate the Linkedin client
$client = new Client(
'LINKEDIN_APP_CLIENT_ID',
'LINKEDIN_APP_CLIENT_SECRET'
);
use LinkedIn\AccessToken;
use LinkedIn\Client;
// instantiate the Linkedin client
$client = new Client(
'LINKEDIN_APP_CLIENT_ID',
'LINKEDIN_APP_CLIENT_SECRET'
);
// load token from the file
$tokenString = file_get_contents('token.json');
$tokenData = json_decode($tokenString, true);
// instantiate access token object from stored data
$accessToken = new AccessToken($tokenData['token'], $tokenData['expires_at']);
// set token for client
$client->setAccessToken($accessToken);
$profile = $client->api(
'ENDPOINT',
['parameter name' => 'its value here'],
'HTTP method like GET for example'
);