Integration with LinkedIn.com Part 2

In a previous article we took an initial look at how a business-oriented community website can benefit from integrating with LinkedIn.com, outlining the steps necessary to utilize the LinkedIn API and OAuth to do this. Now we’ll look more deeply at the achievement of integration and the ability to allow your users to invite LinkedIn members directly to your website. The library that we are using and that we referred to in our previous artcle, is this one.

So, again, this integration task consists of two parts: first, the user must search for a friend whom they wish to invite to your site and then the invitation must be sent.

1. The search function is outlined very well in the LinkedIn API documentation so we’ll skip here directly to a simple example in order to highlight the most important features:

//searching of all friends named Ann$search_response=$linkedin-&gt;search("?facets=network&amp;facet=network,F&amp;first-name=Ann");$xml=simplexml_load_string($search_response);foreach($xml-&gt;people-&gt;person as$person){print_r($person);}

Take special note:

All parameters of a search inquiry are connected with logical AND.

2. Unfortunately LinkedIn does not allow us to detect the email address of a user but invitations can be sent via LinkedIn’s on-site messaging system. While the API will allow us to send on-site messages, the feature is not implemented in the linkedin.php library which we’ve loaded and so we’ll need to modify a bit. Add this code into the file linkedin.php:

WildCard is not supported.

If a search returns too many results you are able to narrow them done using the “total” parameter in the returned XML: