Now a days most popular host sites provide api so that we integrate in our site to create mash-up application. Linkedin recently published their own apis. So now we can integrate linkedin apis in our site. So why we should integrate linkedin api:
- Users can bring linkedin profile and network in your site
- There are 52 millions users in linkedin so you can engage them in your site
- You may create authentication through linkedin api so that user don’t need to register in your site
- You can search profile, connection
- Users can also update their status from your site using linkedin apis
- And many more…
In this tutorial I’ll show how could you integrate linkedin api in your site, search a company name and get your profile info.
Before proceeding:
Look at the LinkedIn APIs Terms of Use
1.visit https://www.linkedin.com/secure/developer and click Add New Application.
Now fill the form. You have to must fill * Indicates.
Integration Url would be your project url. Here I filled http://thinkdiff.net/demo/linkedin
oAuth Redirect Url would be the web page url. In my case I provides http://thinkdiff.net/demo/linkedin/demo.php
Now click Add Application. Then you’ll get Api Key and Secret Key for your application.
Linkedin also used oAuth library, so if you don’t understand what is oAuth you can read my earlier article http://thinkdiff.net/php/develop-auto-post-publishing-twitter-app/
Now look at the project files
Now look at auth.php codes
<?php
session_start();
$config['base_url'] = 'http://thinkdiff.net/demo/linkedin/auth.php';
$config['callback_url'] = 'http://thinkdiff.net/demo/linkedin/demo.php';
$config['linkedin_access'] = 'xxxxxxxxxxxxxxYour_API_KEYxxxxxxxxxxxx';
$config['linkedin_secret'] = 'xxxxxxxxxxxxxxYour_Secret_Keyxxxxxxxxx';
include_once "linkedin.php";
# First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
$linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url'] );
//$linkedin->debug = true;
# Now we retrieve a request token. It will be set as $linkedin->request_token
$linkedin->getRequestToken();
$_SESSION['requestToken'] = serialize($linkedin->request_token);
# With a request token in hand, we can generate an authorization URL, which we'll direct the user to
//echo "Authorization URL: " . $linkedin->generateAuthorizeUrl() . "\n\n";
header("Location: " . $linkedin->generateAuthorizeUrl());
?>
Now look at the demo.php codes
<?php
session_start();
$config['base_url'] = 'http://thinkdiff.net/demo/linkedin/auth.php';
$config['callback_url'] = 'http://thinkdiff.net/demo/linkedin/demo.php';
$config['linkedin_access'] = 'xxxxxxxxxxxxxxYour_API_KEYxxxxxxxxxxxx';
$config['linkedin_secret'] = 'xxxxxxxxxxxxxxYour_Secret_Keyxxxxxxxxx';
include_once "linkedin.php";
# First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
$linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url'] );
//$linkedin->debug = true;
if (isset($_REQUEST['oauth_verifier'])){
$_SESSION['oauth_verifier'] = $_REQUEST['oauth_verifier'];
$linkedin->request_token = unserialize($_SESSION['requestToken']);
$linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
$linkedin->getAccessToken($_REQUEST['oauth_verifier']);
$_SESSION['oauth_access_token'] = serialize($linkedin->access_token);
header("Location: " . $config['callback_url']);
exit;
}
else{
$linkedin->request_token = unserialize($_SESSION['requestToken']);
$linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
$linkedin->access_token = unserialize($_SESSION['oauth_access_token']);
}
# You now have a $linkedin->access_token and can make calls on behalf of the current member
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url)");
echo '<pre>';
echo 'My Profile Info';
echo $xml_response;
echo '<br />';
echo '</pre>';
$search_response = $linkedin->search("?company-name=facebook&count=10");
//echo $search_response;
$xml = simplexml_load_string($search_response);
echo '<pre>';
echo 'Look people who worked in facebook';
print_r($xml);
echo '</pre>';
?>
Now visit your site’s url in my case http://thinkdiff.net/demo/linkedin/auth.php
After login in linkedin and providing access it will redirect to http://thinkdiff.net/demo/linkedin/demo.php and you’ll see your linkedin profile information and some peoples information who worked in facebook. If you want to search other company just modify this line
$search_response = $linkedin->search("?company=your_desire_company&count=10");You can also search name, title and many more. To see the complete list of parameters check http://developer.linkedin.com/docs/DOC-1005
To get more information about linkedin api please visit http://developer.linkedin.com/community/apis
You can also update the linkedin.php library and add new method for your purpose. For example look at the search method of this file
function search($parameters) {
$search_url = $this->base_url . "/v1/people-search:(people:(id,first-name,last-name,picture-url,site-standard-profile-request,headline),num-results)" . $parameters;
//$search_url = $this->base_url . "/v1/people-search?keywords=facebook";
echo "Performing search for: " . $parameters . "<br />";
echo "Search URL: $search_url <br />";
$request = OAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, "GET", $search_url);
$request->sign_request($this->signature_method, $this->consumer, $this->access_token);
$auth_header = $request->to_header("https://api.linkedin.com");
if ($debug) {
echo $request->get_signature_base_string() . "\n";
echo $auth_header . "\n";
}
$response = $this->httpRequest($search_url, $auth_header, "GET");
return $response;
}
So the function’s code is not too difficult to understand, right? So if you want to add invitation api http://developer.linkedin.com/docs/DOC-1012 in your project then create a new function like function invitation(){} where you’ll implement the invitation api from linkedin by copying the above code and modifying some lines.
And don’t forget to know about some limits by linkedin, regarding api calls. Visit http://developer.linkedin.com/docs/DOC-1112 to know details.
I hope you understand about the basic usage of linkedin apis and you can now integrate in your project easily.













Nice post , thanks for share
definitely a very good article. i like as you described every steps nicely
Very detailed article. However, I can’t seem to find the linkedin.php file in http://oauth.googlecode.com/svn/code/php/ Any help is appreciated. Thanks.
@Alvin, I updated the link actually download the linkedin.php and oauth.php from here
http://developer.linkedin.com/servlet/JiveServlet/download/3005-1178/LinkedInOAuth-PHP-WithSearch.zip;jsessionid=8AD7DC6FC927780812298C29BF7F2217.node0
Hi,
I want to know how linkedin can update the status message in itself and twitter at the same time. Where can I find the source code?
@Iris, you’ve to develop your own solution. You can integrate this solution with http://thinkdiff.net/php/develop-auto-post-publishing-twitter-app/ twitter solution so that you can update twitter status and linkedin status at the same time.
@ Mahmud: Thanks!
I have already gone through that but my question is what else is there apart from the four steps in that. I mean that it self is a solution right?
@Iris, you’ve to modify the codes so that is serves your purpose. Simply the logic is, you need a admin panel where you’ll first authenticate twitter and linkedin and you need a text field where you’ll put your status. After submit the status will update in linkedin and twitter. So you’ve to code what will happen after submission. I’ll keep in mind about your problem and if I make time, I’ll write a post regarding it. So tune my site.
@mahmud ahsan, thanks a lot for the link. However, right now I have an error at the LinkedIn authorization page which says “We were unable to find the authorization token”. Upon googling, one possible problem could be because my system clock is out of sync with LinkedIn’s. Any clue on how do I sync my system clock?
@Alvin, this is very weird. And I’m really not sure why this happened. One thing you can try with different browser or different Os. Sometimes the bug may happen on linkedin, I’m not sure!!!
@mahmud ahsan, I realized that when I reach the authorization step, my application does not have an authorization URL generated. Just wondering whether there’s anything I need to edit besides the base_url, callback_url, API key and secret key?
If I’m testing on localhost, is it an issue?
@Alvin, i’m not sure is the problem happened for localhost or not as I directly tested that code on server.
@mahmud ahsan, never mind. I’ll try to figure out how to solve it. Thanks for the help anyway.
@mahmud ahsan, I’ve managed to get the linkedin api working with Zend Oauth framework. However, I would still like to make use of your codes as it’s simpler to understand (and hence easier to make future modifications). I did some tests on my codes and made the following observations:
I realized that the problem lies in the request token step. I printed out the $response object in the getRequestToken() function in linkedin.php and it’s empty.
It seems that the $data object in the httpRequest() function in linkedin.php is empty as well. As such, I would like to check with you whether the parameter values that I’m passing in is correct:
$url = https://api.linkedin.com/uas/oauth/requestToken?oauth_callback=http%3A%2F%2Flocalhost%2Flinkedin2%2Fdemo.php&oauth_consumer_key=LrH1Ck7-bNVGX57WstY_HxnmsPbIN1a4OIwi-LjUnAsHKJJaks2DU6ahIa5kb5DJ&oauth_nonce=698b4ab5efafeadd382884b26fd858c4&oauth_signature=%2BRV59Bm4pZfpGP9mkWC5BCiy56k%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1269265649&oauth_version=1.0
$auth_header = Array
$method = GET
Thank you for your help.
@Alvin, I didn’t pass any parameter by myself, and couldn’t understand what the problem you’re facing. Did you run successfully my code yourself, my codes working nicely here http://thinkdiff.net/demo/linkedin/auth.php
@mahmud ahsan, I’m able to run your auth.php perfectly. The problem is that when I reach the authorization page, I am unable to retrieve a request token so the authorization url has no value for oauth_token.
@Alvin, In the application setting, did you provide the oAuth Redirect url correctly ? And also check if session is working correctly or not. some of my friends, run my codes successfully without any problem. So its really confusing why this problem occurs in your side. Are you running the code in localhost or in any server?
i have problem in sessions
your software is awesome, but my session getting reset once after Header function,
its very much cool at auth.php–>i got a linkedin login page,it worked fine and good, its again coming back to my callback page(demo.php)..here it shows 404,
its due to the session variable getting reseted ,,,
please suggest me ,what are the precautions you took in php.ini file, and please let me know, if i have missed anything
Regards/Jazakalla
AB
@mahmud ahsan, my callback url should be correct. In any case, here’s my settings
$config['base_url'] = ‘http://localhost/linkedin2/auth.php’;
$config['callback_url'] = ‘http://localhost/linkedin2/demo.php’;
Besides setting these 2 config parameters and the API key and secret, is there any other changes I need to make? I’ve not made any changes in OAuth.php and linkedin.php; is there anything I need to change in these 2 files?
I’m sure that your codes are fine, because I can run your example perfectly so I think the problem should lie with my configurations, which I’m trying to figure out where the problem lies.
I’m running the code on localhost but that shouldn’t be a problem since I can run the codes successfully on localhost using the Zend OAuth framework.
If I still can’t figure out how to solve this then I guess I’ll stick to using the Zend OAuth framework then. Anyway, thanks for your help so far.
Hi Alvin,
I am also facing the same problem as you did “We were unable to find the authorization token”.
How did you solve the problem by using Zend frameowrk. What exaclty you mean when you say you used Zend framework. Is it Server? or anything else or any change in the code..
Thanks,
Viren
@Alvin, Please run this code in server, not in your localhost. I think you’ll face no problem. There is no more changes on other files those you mentioned. May be zend oAuth library works differently than my example.
@mahmud ahsan, I guess I’ll stick to my working Zend OAuth framework then since it’s the only one I can get to work. Thanks for the help anyway. Really appreciate it.
Hello,
if I store ‘requestToken’, ‘oauth_verifier’ and ‘oauth_access_token’ in DB is possible to use it after 1,2,10 days?
regards,
@Tony, if user approve the permission as Until Revoked then you can use it for infinite time. But if user approve for one day or one week then you’ve no choice.
Hi.
Maybe I didn’t understood something, but each time after login, when I want to get profile (with specified fields, or only with ‘~’) I get the error:
I can’t investigate what is wrong, can’t make it work.
My header is:
Is there anything what I should check?
Hi,
I am also going through the same problem of Could not find person based on: ~
@Amores, I think the problem is something related authentication. Please visit this link http://thinkdiff.net/demo/fblinkedtwit/index.php and check if linkedin works for you or not. And the code for this project is open source checkout the article: http://thinkdiff.net/facebook/open-source-facebook-twitter-linkedin-status-update-application/
I tried running the php codes, but it does not result/output anything. I tried ‘debugging’ the auth.php file and when i
‘echo “Authorization URL: ” . $linkedin-> generateAuthorizeUrl() . “\n\n”; ‘
i get the following:
Authorization URL: https://api.linkedin.com/uas/oauth/authorize?oauth_token=
I have a feeling that $linkedin is empty, ie. the ‘ new LinkedIn() ‘ command is not generating anything. Any reasons as to why this might be happening?
That is due to TimeStamp_refused error in OAuth.php,
you will find more in below blog http://developer.linkedin.com/thread/1202,
you have to sync with NTP timestamp to get this work,
even after generating oauthToken, am getting 404 in demo.php,
please suggest,thanks in advance
@itsmeok, same answer for you. Please check this article http://thinkdiff.net/facebook/open-source-facebook-twitter-linkedin-status-update-application/ and check if linkedin status update works for you or not. If it works for you then please checkout the code of that project.
Thanks for the quick reply, mahmud!
I tried the link you gave me, the linkedin access was working on your link. However, when i checkedout the code and ran it on localhost, and click on ‘Give LinkedIn access’, it opens a blank page.
Have you faced this before? Am i doing something wrong?
@itsmeok, i think this code will not work in localhost, but I’m not sure. Normally I tested this code directly on server.
thanks.
I wan’t to create profile in my page basing on my profile from linkedIn but I can’t get my email address. Is there any way to do pass it via XML? If not – maybe I could save it in session somehow?
@amores, I don’t find email retrieving system in their api documentation http://developer.linkedin.com/docs/DOC-1002
You can save email to session as your own way.
Just to let people know if you use the above method of getting the linkedin.php file, that the setStatus function is not working correctly.
It should be:
function setStatus($status) { $status_url = $this->base_url . "/v1/people/~/current-status"; echo "Setting status...\n"; $xml = "" . htmlspecialchars($status, ENT_NOQUOTES, "UTF-8") . ""; echo $xml . "\n"; $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, "PUT", $status_url); $request->sign_request($this->signature_method, $this->consumer, $this->access_token); $auth_header = $request->to_header("https://api.linkedin.com"
;
if ($debug) {
echo $request->get_signature_base_string() . "\n";
echo $auth_header . "\n";
}
$response = $this->httpRequest($status_url, $auth_header, "PUT", $xml);
return $response;
}
This took me a while to debug so thought i’d save others the trouble.
@Jarrod, Thanks you’ve noticed that. I also noticed that and fixed that but in another project.
Checkout my open source project.
http://thinkdiff.net/facebook/open-source-facebook-twitter-linkedin-status-update-application/
The code above seems to be working fine and I get my response in $xml_response.
Example of XML code I see when I do view source on the page is:
Kunal
……
How do I parse out data from this to display on the page?
So if I want to get First name from above and display on my page as :
First Name: Kunal
@Kunal, you can use php’s simple xml to parse xml data
Hi,
I tried it but could not get it exactly. Here is my xml when I do view source. How can I assign the firstname and lastname to varaibles so I can output it as I need on my page?
Kunal
Punwani
@Kunal, its very easy.
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url,public-profile-url)"); $data = simplexml_load_string($xml_response); <table border="0" cellspacing="3" cellpadding="3"> <tr><td>Name</td> <td><a target="_blank" href="<?=$data->{'public-profile-url'}?>"><?=$data->{'first-name'}?> <?=$data->{'last-name'}?></a></td></tr> <tr><td>Headline</td> <td><?=$data->headline?></td></tr> <tr><td>Profile Image</td> <td><img src="<?=$data->{'picture-url'}?>" alt="" /></td></tr> </table>You can check my another article http://thinkdiff.net/facebook/open-source-facebook-twitter-linkedin-status-update-application/ and could check the demo to see how I show user info.
hello Mahmud
i got this working with simplexml but i can’t get a level deeper, for instance: date-of-birth it consists out of , and
if tried:
{‘date-of-birth->day’}?>
date-of-birth->day; ?> and al kind of different ways…
sorry right after i posted the question i saw the light:
{‘date-of-birth’}->day ?>
thanks anyway and thanks for the great script
Thanks alot Mahmud Ahsan. This is very useful.
Is there a way to retrieve the Contact Settings for a user thru the LinkedIn API?
For example, I want to be able to retrieve the following:
Interested In:
career opportunities
consulting offers
reference requests
getting back in touch
@Kunal, I think currently linkedin yet not open those fields for user. I just checked from here http://developer.linkedin.com/docs/DOC-1002
Anybody had trouble running this on Yahoo! Domains?
I can’t get auth.php to do anything. There is no error msg but I can tell it stops at the ‘include_once “linkedin.php”;’ since I can echo a debug statement before that line but not after.
Thoughts?
Great post! thanks
Dear mahmud ahsan,
Thanks.. so far work!!!!!
Can you please tell me how I can re-use the access-token of a user of linked to update status without login second time at linkedin.
Like your twitter Demo…
You can save the access token in your database, but in linkedin access token has expiration date like 1 day or 2 week. So after that time your token will expire. So you’ve to cleverly code to solve this problem.
Advance thanks……..for tutorial…
… can u give the same explanation by using java………in all links they are giving in php……..but we are developing our application in java…..so please give reply………..
I don’t work on java based web application development. So I’m sorry.
Hi,
Thanks for the useful code. I followed all the steps that you mentioned in above but when I run ‘auth.php’ it gives me below message : “http 500 internal server error”.
I am using enginisite local web server.Below are the details,
$config['base_url'] = ‘http://127.0.0.1:8080/Project/auth.php’;
$config['callback_url'] = ‘http://127.0.0.1:8080/Project/demo.php’;
I am new to php so would need your help to understand where I am going wrong. Thanks..
Kind Regards,
Viren
Please use use the code in hosting server not in localhost.
Hi Mahmud,
Thanks for helping me out on my issue.
Now when I execute it , while diverting to the linkedin site it givs below error,
We were unable to find the authorization token
I have passed both the keys correctly. What may be the problem.
Thanks,
Viren
Greetings,
Mahmud, This is great article; very easy and simple to implement OAuth Linkedin.
I am using it and I am getting the profile information. Currently I am indulged in Messaging API; I want to implement it. It suppose to POST the xml.
..
I tried same as setstatus function is implemented for posting xml, but I think setstatus is working. As it is not posting xml i guess; but i can be wrong
Do you know how to do it for messaging xml? how can i post it.
Here is document link from where i m getting assistance.
http://developer.linkedin.com/docs/DOC-1044
Pardon my knowledge of PHP, I am new in it :-s
Thanks
Thank you i have got the solution
; we just need to post data in httprequest($var1,$var2,var3,$xmlbody) in callback method..
xml is below..
$bodyofxml= Congratulations! you have sent the message, now try to send it to someone else You’re certainly the best person for the job! ;
request->httprequest(,,,$bodyofxml);
and thats it
Thanks again Mehmud;
Now if you see this post, just let me know at how much extent you modified this oauth.php file from the google source code ??
Hi,
I tested the code on the server, but it showed error:
“My Profile Info
404
1282320837023
0
Could not find person based on: ~
Performing search for: ?company=facebook&count=10
Look people who worked in facebookSimpleXMLElement Object
(
[status] => 404
[timestamp] => 1282320837091
[error-code] => 0
[message] => Could not find person based on:
)
”
Do you know what is wrong? I didn’t change anything of the code except the consumer key, integrate url, redirect url and consumer secret key.
Thank you very much
HOw you solve this problem?
I am facing this problem
My Profile Info
404
1304243686623
0
Could not find person based on: ~
Performing search for: ?company-name=facebook&count=10
Look people who worked in facebookSimpleXMLElement Object
(
[status] => 400
[timestamp] => 1304243687349
[error-code] => 0
[message] => Unknown key {} for collection field {Root.people}
)
Hi! . i am really new to this and i’ve been reading your post since i’ve started working on it… You said that I can edit it and create a new function such as the invite function. I am trying to create a sndMessage function to send message to a particular user, but it seems not to be working… Please look at my code below.. Thank you in advance.
function sndMessage($msgrecipient) {
$msg_url = $this->base_url . “/v1/people
$msgxml = “Good dayI hope you are doing well
”;
$request = OAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, “POST”, $msg_url);
$request->sign_request($this->signature_method, $this->consumer, $this->access_token);
$auth_header = $request->to_header(“https://api.linkedin.com”);
if ($debug) {
echo $auth_header . “\n”;
}
$response = $this->httpRequest($msg_url, $auth_header, “POST”, $msgxml);
return $response;
}
Hi ali,
are you trying to create a function that can send message to some of your contacts? can you share it? i’m also new in php and linkedin apis..
like what did you edit? you copied the setstatus function?
thanks!!
I’m getting also “We were unable to find the authorization token”. Any solution for this?
Thanks on advance.
Alexandre
Thanks for another great tutorial Mahmud. It was very helpful.
If anyone is having problems generating an authorize URL on a localhost server, it could be a problem with the CURL function in linkedinOAuth.php
I am using MAMP for my localhost server and couldn’t generate an authorize URL until I added this to line 123:
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
Thank You for your information.
I am using wamp on localhost I have problem in auth.php(Fatal error: Call to undefined function curl_init())
and demo.php(
Notice: Undefined index: requestToken
Notice: Undefined index: oauth_verifier
Notice: Undefined index: oauth_access_token
Notice: Undefined variable: debug
Fatal error: Call to undefined function curl_init())
Kindly reply urgently It is my first task in First Job.
Checkout the code from linux server.
Problem is solved for CURL in localhost using WAMP
Go to C:\wamp\bin\apache\Apache2.2.17\bin\php.ini
remove ; of php_curl and restart WAMP SERVICES.
but problem exists in demo.php(
Notice: Undefined index: requestToken
Notice: Undefined index: oauth_verifier
Notice: Undefined index: oauth_access_token
Notice: Undefined variable: debug)
I read your article and tried to implement for codeigniter .
I need linkedin user permanent access. I used your codes (demo.php) in my controller.
Now how can I get permanent access token ? which I want save in database for long time use.
Please save oauth_access_token and oauth_verifier and requestToken in your database. But normally after giving access oauth_access_token and requestToken become same. And next time when you initialize the linkedin class object first check if these tokens are in your database or not. If these tokens are in your database then retrieve them from database and initialize the linkedin object.
Very good work
Hi, can this be possible integrating linkedin login wordpress blog??what is the easiest way?thanks
Why not, develop a plugin using linkedin api.
Good stuff!! Work like a charm…
2 small questions:
1. doing a status update (already figured out that line 99 in linkedin.php was wrong by the way), where would I find that on my linkedIN page? I realize this is more a LinedIN howto question than an API question….
2. Can anyone point me in the right direction of doing a “network update” instead of “status update”? I took the setStatus-func and change the url from current-status to person-activities, but no luck….
Thanks,
all help appreciated
Cees
Cees, status update api is deprecated please check there new documentation regarding api. And also you could check my another article http://thinkdiff.net/php/integrate-linkedin-api-part-2/
You are my hero!!! The share-function in part 2 was exactly what I was looking for!!!
Hello
this post is very informative
i like this post
thanks for sharing knowledge,
Hi Mahmud,
I get a message status updated successfully, but can’t see my status updated on facebook or linked in. Does the status gets changed immediately or it takes time ?
Regards
Rakesh
I want C# code to get basic user information from linkedIn using linkedIn API’s.
@Mahmud
hi,
i can get the linked in authorisation page but after logging in, i get the following error:
Warning: Cannot modify header information – headers already sent by (output started at /home/content/86/6578386/html/demo/linkedin.php:133) in /home/content/86/6578386/html/demo/act_demo.php on line 18
i dont know why this happening..i have followed the code as it is, without any changes.plz help
@mahmud ahsan is it possible to zip up all your files i.e. auth.php, demo.php, linkedin.php and oAuth.php
I have a feeling there are some problems when people are getting the newer oAuth.php files from external sources etc.
Thanks
Please tell me why I am getting this error
401 1295003706554 0 [unauthorized]. No consumer found for key.
I was facing “We were unable to find the authorization token” while deploying in ubuntu .
Things were fine in debian.
I am using new linkedin apis.
Solution:
open linkedin.php
in the httpRequest function add:
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
I also changed ubuntu timezone to EST using follow command:
ln -sf /usr/share/zoneinfo/EST localtime
This erros should be fixed and linkedin should return request token.
Thanks a lot, Ahsan this is very useful. I need to know, how I can get Current Position, Language, Location and Company.
And also please tell me if i get xml through API like this
”
Taylor
Singletary
Technical Evangelist at LinkedIn
http://www.linkedin.com/profile?viewProfile=&key=3308337&authToken=REQa&authType=name
”
how i will read it through PHP i mean how to assign these values to variable.
Thanks in anticipation.
my code was parsed in last post in fact i actually want to do that which coincidentally happened when submitting post here. I try to publish my code again with code tag.
Taylor
Singletary
Technical Evangelist at LinkedIn
http://www.linkedin.com/profile?viewProfile=&key=3308337&authToken=REQa&authType=name
Hi Mahmuud, How can i print or echo only first name from XM_response.
In the above example there are all values printed but i need those values at different place one by one like
First name :
******some text
******
Last Name :
********some text
******
How can i get one by one value from all values…?
Waiting For your response..
Thanks
Hey man, using xml parsing you can easily parse the xml output to get name. So learn simplexml of php to parse xml.
@mahmud thanks for response..actualy i dont have time to create manualy in Socialengine4 environment..So i need module for socialengine4.. I knw about XML but its urgent thats y m finding..so pleas help me yar..
hi mahmud,
i need to update the status from an asp.net application.. can you post the source code for this. Please am in urgent need for this:( i lll be much thankful to you… pls help me out
Akil,
U got any idea for Asp.net ??
Hi! You look like you can understand all this linkedIN api stuff;;
Can you tell me if it is possible for me to display my own linkedIN recommendations on my website without anyone having to be logged into LinkedIN to see them?
I want them to show up just like my testimonials do here : http://go-etree.com/testimonials.
Please let me know if it is possible and where I should start looking to figure it out! Thanks!
Please check linkedin documentation, I worked on linkedin api long ago.
Hi,
I want to create a login page in our site and after login from my site i get the information in my site of my friends.
How it will do??
Please solve my problem.
If you have code the provide me also.
Thanks
@mahmud your code working perfectly fine on localhost. Thanks for sharing.
hi
how can i get an access to inbox and filter the messages on the basis of keywords
I want to make app for filtering messages from your inbox on basis of keywords.
I want to show my linkedin group discussion articles on my website. Can I get a rss feed from the LI group discussion list? is there a better way. Oh, also our new website is being built on sharepoint platform.
Any one have the link or update about the same kind of project in ASP.Net or C# ???
@mahmud ahsan: great work..
@alvin: i was also facing the same issue while accessing the linkedin api (https), i found a solution at this link “http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites” though it is not a safe method but it works for me.
i didn’t get OAuth.php and linkedin.php files can u please send OAuth.php and linkedin.php
my id (bikeshm@gmail.com)
hi
https://developer.linkedin.com/servlet/JiveServlet/download/3005-1178/LinkedInOAuth-PHP-WithSearch.zip;jsessionid=8AD7DC6FC927780812298C29BF7F2217.node0
this is URL is not working
Hi mahmud ahsan
Good Job
I have one confusion . how can i implement this code in zend framework .
please explain me step by step.
Thanks
@mahmud can you tell is any post function is availsble ( message posted to another users linkedin account) like $search_response = $linkedin->search(“?company-name=facebook&count=10″);
Using linkedin api you can send message to other linkedin user. I don’t know what you mean by message post.
hi mahmud ahsan, i want to know how to integrate this apps to wordpress site. these files are opensource and thanks for share but please let me know more about to how to pull data from linkedin profile to my website or other…
You have to create wordpress plugin for your purpose.
is there a widget to display the update of the specific user into the website just like in twitter the tweets are displayed in websites
Great post! Thanks for sharing. This has really helped me today
Hello There
thanks for your great post its help us to much
but i have one problem how can i integrate that in my Social Engine CMS.http://mxicoders.in/linked/home.php
i want to show the Linkedin News feed in my home page for particular users.
Thanks
Amrish
Please check linkedin documentation, now a days they provide JavaScript SDK so quite easy to call the api.
Hello mahmud
thank you very much for your reply. i am a new in Social Engine linkedin programming so can you plz show me the demo
i show the linkedin developer document
http://developer.linkedinlabs.com/tutorials/jsapi_netstream/#
https://developer.linkedin.com/documents/tutorials
plz help
Thanks
Amrish
Thank you sir..
This is really a helpful guide for linkedin API’s integration…:)
best tuts for linkedin integration! thanks thanks!
Really Good Tutorial Mahmud………………keep it up!!!!!!!!!!!!!
Hi,
Can anyone of you please mail me the zipped file of this properly working project..
I need it immediately for learning purposes.
My Email is is ranjithshenoy215@gmail.com
Help in this regard will be highly appreciated.
Thanks.
Hi,
I need to create a web app in which we can read a particular person’s name from a text box and then extract relevant information of that person from Linkedln.
Please reply soon.
Thanks
Hi mahmud,
your tutorial really rock!
I have a question for you: i do not have cURL in my settings, and how can i use your code without cURL support?
thank you very much in advance,
andrea
Hello,
I’m not sure, in that case you may have to use socket. But in that case you may need to update the linkedin code.
Is there a way to display sample application on Linkedin wall as that of slideshare?It is kind of urgent pls let me know sooooonnnn:/
hey,my simple demo working on localhost..
but when i put it to the server..
it gives an error..
so please let me know how should i change so that it can work properly..
Server error
The website encountered an error while retrieving http://www.mydomain.com/invite. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request…
and not showing any content..
thanx in advance
i wan to know if i can modify the styles of the api, for example width and all of that
Very good article…thank you!…
Hi
how to post a job from site to linkedin. please anybody have a sample code.
hi
how to post a job from site to linkedin. please anybody have a sample code. using java
Hi,
can any one help me out with how to make a post in a group?
i tried the same way its mentions in update user status….
added the required attributes in xml format
but its making any post in group …… and also m not getting any error…….
I can not post status with this app……..can any one help
hello!
http:192.168.0.2:11016/demo.php?oauth_token=1a58a8ae-a712-4b6a-93c5-092558958951&oauth_verifier=24241
where to put this ???
reply soon
how can we import connections ?
how can we import connections??
the link http://developer.linkedin.com/docs/DOC-1005 is not available.. pls change/remove dat…
I really like this useful information and I would like to share my community because they are still waiting this kinds of api for linkedin….
Hi Mahmud,
This is informatics article, I really like the post shared by you. I need also access of permanent users in LinkedIn. I obtain a message status updated successfully, but can’t see yet my status updated on Facebook or linked in. Please suggest me it would be immediately or it takes time?
Thanks for sharing.