PHP code example of scottybo / linkedin-api-client-v2
1. Go to this page and download the library: Download scottybo/linkedin-api-client-v2 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/ */
scottybo / linkedin-api-client-v2 example snippets
/**
* This demonstrates how to authenticate with LinkedIn and send api requests
*/
/*
* First you need to make sure you've used composers auto load. You have is probably
* already done this before. You usually don't bother..
*/
//echo "Welcome ".$user['firstName'];
exit();
} elseif ($linkedIn->hasError()) {
echo "User canceled the login.";
exit();
}
//if not authenticated
$url = $linkedIn->getLoginUrl();
echo "<a href='$url'>Login with LinkedIn</a>";
// By constructor argument
$linkedIn=new Happyr\LinkedIn\LinkedIn('app_id', 'app_secret', 'xml');
// By setter
$linkedIn->setFormat('xml');
// Set format for just one request
$linkedIn->post('v1/people/~/shares', array('format'=>'xml', 'body'=>$body));
// By constructor argument
$linkedIn=new Happyr\LinkedIn\LinkedIn('app_id', 'app_secret', 'json', 'array');
// By setter
$linkedIn->setResponseDataType('simple_xml');
// Set format for just one request
$linkedIn->get('v1/people/~:(firstName,lastName)', array('response_data_type'=>'psr7'));