line 542: public wxservicesoapclient()这line out是什么意思思谁帮我看

Now a days most popular
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
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
Now look at the project files
Now look at auth.php codes
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 =
# 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
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 =
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']);
$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_
echo '&br /&';
echo '&/pre&';
$search_response = $linkedin-&search(&?company-name=facebook&count=10&);
//echo $search_
$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
After login in linkedin and providing access it will redirect to
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
To get more information about linkedin api please visit
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)& . $
//$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(&&);
if ($debug) {
echo $request-&get_signature_base_string() . &\n&;
echo $auth_header . &\n&;
$response = $this-&httpRequest($search_url, $auth_header, &GET&);
So the function’s code is not too difficult to understand, right? So if you want to add invitation api
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
to know details.
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:
Subscribe to our e-mail newsletter to receive updates.
Related Posts:
November 11, 2014
May 15, 2014
February 4, 2014
May 28, 2010
May 2, 2010
May 26, 2011
March 16, 2010
Recent Tweets
Freelance Web
Winners don't do different things, they do things differently - Shiv KheraJava代码实战之
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们,本站将立即处理。谢谢合作!

我要回帖

更多关于 publichd是什么意思 的文章

 

随机推荐