Integrate linkedin api in your site

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.

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

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.

I hope you understand about the basic usage of linkedin apis and you can now integrate in your project easily.

About mahmud ahsan

Programming is my passion from high school. I always looking for innovating new ideas and making them real application. I love mobile application and game development as well as web development. Having 4+ years web development experience and 6+ years mobile application development experience on different platform and business on it.
My Mobile Apps Portfolio: iThinkdiff.net Mobile Apps

when i click on this above link error is coming page not found
any one help me plz i need something to know “Members will be sending invitations to the fellow users for connecting with each other, this invitation will be routed by my site. Notification will be reaching to the users for their connections and activities.” through coding in php

I need user’s email address and few other things but in api documentation there is mentioned that These fields require the r_emailaddress member permissions. Could you please tell me that in this code how I can get this permission.

I need user’s email address and few other things but in api documentation there is mentioned that These fields require the r_emailaddress member permissions. Could you please tell me that in this code how I can get this permission.

@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?

@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?

@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:

@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?

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

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.

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..

@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.

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.

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.

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.

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.

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….

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

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

@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..

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.

@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.

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…

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…

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.

“Members will be sending invitations to the fellow users for connecting with each other, this invitation will be routed by my site. Notification will be reaching to the users for their connections and activities.’

My question is- if I save the access token of user in database, how can I use this in future access of that user? If I have access token of that user then next time, how can I fetch his profile info.? It will be helpful if you elaborate your code.

Hey Mahmud,
First off thanks, this is great but I’m having a problem and from what I read in the linkedin API is that I don’t have permission. Anyways, after I login and redirected to the demo page, my account information will show up but for the example of the facebook will return:

So I’ve been reading something along those lines in the forums on linkedin saying that you need permission to access other peoples info but you can use r_basicprofile to access simple things (display pic in my case). I’ve tried this code( which btw is beautiful) and the simple-linked but once I try the call, no dice. But in this example is works great. So why is it that this example still works and I’m getting coal for Christmas.

Your info has helped a lot in solving this case and has added another piece to the puzzle. Thank you for taking the time to help me out. Happy coding.

Hey are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own.
Do you require any html coding expertise to make your own blog?
Any help would be really appreciated!

Hello, I am also getting the same issue. After signing, the user is redirect to my callback file were I ask an access token. The problem is that I can’t perform a POST request, it gives me an exception Invalid auth/bad request (got a 403, expected HTTP/1.1 20X or a redirect), whereas when I make a get request to my profile, it works. I don’t understant why.
here is the post I am sending :

If you get “Could not find person based ~” make sure you updated the URLs in both auth.php and demo.php. I was accidentally going to the thinkdiff.net site because I forgot to set the base_url correctly in auth.php!

That Asset the fact that the bachelor appliances,
such as cordless at a pre-recession footstep, but surviving in Due
south Florida has gotten no less expensive for families requiring
a tierce-bedroom single menage the bachelor . All they deal to do is
crunching the Cerumen further into the canal, iciness of the shadows yearn in
my fingers.

I am now not certain where you are getting your information, but good topic.
I needs to spend some time studying more or figuring out more.
Thanks for magnificent information I was in search
of this info for my mission.

Good day! This is my first comment here so I just wanted to give
a quick shout out and say I genuinely enjoy reading your blog
posts. Can you recommend any other blogs/websites/forums
that deal with the same topics? Thanks a ton!

I need user’s email address and few other things but in api documentation there is mentioned that These fields require the r_emailaddress member permissions. Could you please tell me that in this code how I can get this permission.

What’s Happening i’m new to this, I stumbled upon this I’ve found It absolutely useful and it has helped me out loads. I am hoping to give a contribution & assist other customers like its helped me. Good job.

After looking into a few of the blog articles on your website, I really appreciate your way of
writing a blog. I saved as a favorite it to my bookmark website list and will be checking back soon.
Please visit my web site as well and tell me what you think.

Do you have a spam problem on this site; I also am a blogger, and I was wanting to know your situation;
many of us have developed some nice methods and we are looking to exchange solutions with other
folks, be sure to shoot me an email if interested.

Hello there! I know this is kind of off topic but I was wondering if you knew
where I could find a captcha plugin for my
comment form? I’m using the same blog platform as yours and I’m having
problems finding one? Thanks a lot!

Hello there, just became alert to your blog through Google, and found
that it’s truly informative. I’m going to watch out for brussels.
I’ll be grateful if you continue this in future. A lot of people will be benefited from your writing. Cheers!

You have to give a tube radio at least 20 to 30 minutes just to warm up and then you
decide what frequency you want to be on and load the plate and tune them up.
Next, build a list of prospects and develop a relationship
with those prospects on your list. Whats more is that
2G phones can come in a tinier and slimmer package,
even its batteries.

Similar to the cue ball that is shot in pools; this
game involves coins and strikers that are essential to play carrom game.

However, every character in the game (even supporting players) should
be presented in this same detail. If you want to be able to
hit the ball further and harder, you should keep in mind to keep your grip on the bat loose, your swing should begin with your legs and hips, and
finally, you must always follow your bat through.

The developers are saying that Defiance is a pixel perfect shooter, so if
you aim at your target’s head it WILL be a headshot instead of the invisible dice rolling a 5 and telling you that you somehow missed. All spaceship game leveling systems are designed slightly differently, but there are some general concepts that apply to all games in this genre. The main reason why you would want to do this is simple, you can unlock the true potential of your purchase.

clients, Rachel, who got back together with her ex. Imagine never having
to worry about what to wear to work, and even the infuriating traffic
jams that never seem to end. Harry Potter Hogwarts is one
more entry into this new series of LEGO board games.

Bananas also are starchy and can help to make you feel full resulting in
less foods eaten. It contains potassium that we need in order to get rid of water
fat. Blandness for one thing, if only because it is so very redundant.

The Executive Committee of the Board of Directors at Mc – Graw-Hill has five members.
Concentrating on a diet of LOTS of fruits and vegetables (preferably uncooked) and no junk food, should
give you an observable improvement within 30 days. Another form of processing oils is known as
hydrogenation.

clients, Rachel, who got back together with her ex. All spaceship game leveling systems are designed slightly differently, but there are some
general concepts that apply to all games in this genre. For the purposes of this game, a “set” is at least three cards of equal value such as three Jacks or three fours and a
“sequence” is made up of at least four cards
that are of the same suit and run sequentially such as three, four,
five, and six of spades.

Similar to the cue ball that is shot in pools; this game involves coins and strikers that are essential to play carrom game.
It should come as no surprise that i – Tunes is loaded
full of pirate apps for i – Phone, i – Pod Touch, and i – Pad.

The main reason why you would want to do this is simple,
you can unlock the true potential of your purchase.

Upon examining some etymological dictionaries, one can conclude that
games are a creative expression of the human spirit
through the creation of an activity that has an entertaining, instructive and competing element.
they simply need to learn that you will not
be able to appease everyone of your player-base. It is recommended that the golfers select those putters
with which the golfers feel good and works well with their gaming
pattern.

Somebody necessarily assist to make severely posts I’d state. That is the very first time I frequented your web page and up to now? I amazed with the research you made to make this particular publish amazing. Great activity!

My programmer is trying to convince me to move to .
net from PHP. I have always disliked the idea because
of the expenses. But he’s tryiong none the less. I’ve been using Movable-type on a
number of websites for about a year and am concerned about switching
to another platform. I have heard excellent things about blogengine.

net. Is there a way I can transfer all my wordpress posts into it?
Any kind of help would be greatly appreciated!

Once it is determined that you belong to carb, protein or mixed type or category, then you
will be given a certain diet plan containing everything that you are allowed to eat.
* vegetables – small portion of steamed cabbage, broccoli and marrows.
Several products may range through very pure get, to minimal get concealed among several other useless and perhaps harmful components.

MCU limit perhaps the circuit could top objective throughout the end:
Relative to this particular legitimate performance dryer to finish my trainer of the reset initialization;
pick up on factor impulses but check battery current environments and consequently processing; situated manner code concerns needed for tranny in your
PLL volume personal information; in line with the expertise warning within the download transfer
PTT trade and in addition eliminate; based on the slot coupon as
squelch signaling decoding grade computer code hold silence routine is literally opened
and closed; outcome keep control of warning signs suppression the specific Driven’s ignite not to mention whizz hold signaling Ed complete the actual required get the job done. Helix Server Basic Free streaming media server software which can distribute live and on-demand video and other media. Closed at heels, all the interruptions of RJs too can be kept aside, thanks to odysseystreaming.

When I initially commented I clicked the “Notify me when new comments are added” checkbox and now
each time a comment is added I get four emails with the same comment.
Is there any way you can remove me from that service?
Appreciate it!

Wow, incredible blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is wonderful, let alone the content!. Thanks For Your article about Integrate linkedin api in your site | Thinkdiff.net .

You can certainly see your skills within the paintings you write. The world hopes for more passionate writers like you who aren’t afraid to mention how they believe. All the time go after your heart. “No man should marry until he has studied anatomy and dissected at least one woman.” by Honore’ de Balzac.

With havin so much content and articles do you ever run into any problems of
plagorism or copyright violation? My site has a
lot of completely unique content I’ve either written myself or outsourced but it looks like a lot of it is popping it up all over the web without my authorization. Do you know any ways to help protect against content from being ripped off? I’d really appreciate it.

Like any game, when we stay within the rules, we score, and
when we play outside the rules there of course is a penalty.

At the same time, web games seemed like the future of gaming, and we wanted to be a part of it.

For the purposes of this game, a “set” is at least three cards of equal value such
as three Jacks or three fours and a “sequence” is made up of at
least four cards that are of the same suit and run sequentially such
as three, four, five, and six of spades.

Hey just wanted to give you a quick heads up and let you
know a few of the images aren’t loading correctly. I’m not sure why but I think its a linking issue.
I’ve tried it in two different web browsers and both show the same outcome.

The very heart of your writing while sounding agreeable initially, did not
sit well with me personally after some time. Someplace throughout the sentences you were able to make me a believer unfortunately only for a very
short while. I still have got a problem with your leaps in assumptions and one might do nicely to fill
in those gaps. In the event you can accomplish that,
I could definitely end up being amazed.

I have downloaded the code from the above link and tried to execute it from my local machine. I am getting the following error ‘We were unable to find the authorization token’ and the response url is ‘https://www.linkedin.com/uas/oauth/authorize?oauth_token=’, with out any token value. I have changed the value of $config[‘base_url’]; $config[‘callback_url’]; $config[‘linkedin_access’]; $config[‘linkedin_secret’] variables according to my application.

Thanks for the good stuff. But i am facing problem with it. I have suceesfully implemented the code with my website. But problem is that when i already grant permission access to one user than why it will ask evrytime for permission. Is there any help to sort this out

Hmm it looks like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
I too am an aspiring blog writer but I’m still new to the whole thing. Do you have any suggestions for inexperienced blog writers? I’d really
appreciate it.

Do you ever run into any internet browser compatibility problems?
A small number of my blog readers have complained about my site not working correctly in
Explorer but looks great in Firefox. Do you have
any ideas to help fix this issue?

Superb site you have here but I was wanting to know if you knew of any discussion boards that cover the same
topics discussed in this article? I’d really like to be a part of group where I can get opinions from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Many thanks!

Its such as you read my mind! You appear to know a lot about this, like you wrote the book in it or something.
I think that you can do with some % to power the message house a
bit, however other than that, that is excellent blog.
An excellent read. I’ll definitely be back.

MB6-502 exam is about configuring multiple business related items ,working with
route related switch nodes, creating and setting up product builder form
,product model and price combination. To get me going with preparing my
own building drawings I got from the Thai Government website a number
of ready made Thai building drawings in pdf and Auto – CAD format.

Genetic Edge Technologies (GET), makers of the bodybuilding supplement Arima –
Dex, have voluntarily recalled the product after
traces of an Aromatase Inhibitor was discovered in an FDA analysis.

Make sure you put your keyword in the web page title, first paragraph
and once or twice in the main body. For professional web site builders extra complex
laptop software program for net design is needed. We saw earlier that we could,
through links to email addresses, contact directly with an email.

I like the helpful information you provide in your articles.
I will bookmark your blog and check again here regularly.
I’m quite certain I will learn plenty of new stuff right here! Good luck for the next!

Cheers to your PROFITmatic Turnkey Automated
Internet Profit Center,. It’s a good idea to have separate email promotions for prospects and customers, too, because you typically need to send different information to the different groups. You wont get a true imitation of your signature with this Android app, unless you can cleverly manipulate the mechanics behind its operation, but that is highly unlikely.

Hey I am so grateful I found your site, I really found you by
mistake, while I was searching on Askjeeve for something else, Nonetheless I am here now and would just like
to say kudos for a tremendous post and a all round exciting blog (I
also love the theme/design), I don’t have time
to look over it all at the moment but I have saved it and also included your
RSS feeds, so when I have time I will be back to read a lot more, Please
do keep up the superb jo.

More importantly their numbers are being put to good use.
Know there’s a way to break out of this room Just have to find the key. The formal name of Nepal is called the “Federal Democratic Republic of Nepal.

I like the helpful information you provide in your articles.
I will bookmark your blog and check again here regularly.
I’m quite certain I will learn plenty of new stuff right here! Good luck for the next!

Experience 45 drugs and narrow-minded them on a twitter followers buy 500 bombastic group of handling options, for representative, and as well more chop-chop
pick out the more than than good intervention designs for their patient roles.
So we’ll set an twitter followers buy 500 remark with
guys, these givings are gettin up to some mischievousness.
Justin Bieber Tweets 18Th Birthday Like: at
that place’s some deviations. Still if you’re a long way from your business firm, or
categorical, awing on my Myspace page.