fastread homefastrread library fastread menu

PHP Tutorial : Login/ Register With Linked In

Tutorial by:Admin      Date: 2016-04-14 02:03:38

❰ Previous Next ❱

This article will guide you to crate login/ register with linked in.


Please include linkedin_function.php file to your login/register page. You will get the file file from the attached zip file.
You need change your api key and application secrete in linkedin_function.php file. Please follow the following steps to create your own api key and application secrete. Simply go to and Click on Add new Application, then fill up the form. The system will provide you the api key and applicatin secret. Replace both in linkedin_function.php file.


Please insert the following code to display the linked in connect button.


<form id="linkedin_connect_form" action="<?php echo $_SERVER['PHP_SELF'];?>" 
<input type="hidden" name="<?php echo LINKEDIN::_GET_TYPE;?>" 
id="<?php echo LINKEDIN::_GET_TYPE;?>" value="initiate" />
<input type="submit" value="Connect to LinkedIn" name="linkedin" />

When the user clicks on "Connect to LinkedIn Button" it will take the user to linked in login page. If the user logged in successfully to LinkedIn then the system will return back to your login page. Here you can get user's LinkedIn id, first name and last name.

$_SESSION['oauth']['linkedin']['authorized'] = 
(isset($_SESSION['oauth']['linkedin']['authorized'])) ? 
$_SESSION['oauth']['linkedin']['authorized'] : FALSE;
if($_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
$OBJ_linkedin = new LinkedIn($API_CONFIG);

$response = $OBJ_linkedin->profile('~:(id,first-name,last-name,picture-url)');
$result = new SimpleXMLElement($response['linkedin']);
$_SESSION['passcode'] = $result->id; 
$_SESSION['fname'] = $result->{'first-name'};
$_SESSION['lname'] = $result->{'last-name'};


❰ Previous Next ❱

PHP Tutorial

Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website