PHP code example of linkedinapi / linkedin

1. Go to this page and download the library: Download linkedinapi/linkedin 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/ */

    

linkedinapi / linkedin example snippets


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

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

$token = $li->getAccessToken($_REQUEST['code']);
$token_expires = $li->getAccessTokenExpiration();

$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',
    ),
  )
);