Jump to content

PHP connection to LinkedIn


ArticSun

Recommended Posts

Hi all!

 

  I'm trying to retreive my own status updates from LinkedIn, but without success uptill now.

 

I did setup an oAuth communication which resulted in requesting the user for permission for the application to access his profile and I retrieved an access token succefully which I saved in the database.

 

However, when I try the following after that, using the access token:

$options = array(
  'consumerKey' => '[key here]',
  'consumerSecret' => '[secret here]',
);

// This is where I get the token, not really interesting 
$dbSocialAccount = new SocialAccount();
$oSocialAccount = $dbSocialAccount->fetchRow('id = "3"');

$token = unserialize($oSocialAccount->token);
$client = $token->getHttpClient($options);

$client->setUri('https://api.linkedin.com/v1/people/~');
$client->setMethod(Zend_Http_Client::GET);
$response = $client->request();
$content = $response->getBody();

echo 'content:<br /><br />';
echo $content;
exit();

 

It works fine! I get some profile information of the user/my own linkedin account.

Now I want to retrieve the last, say 5, updates from my own account, so I change the request URL to:

 

http://api.linkedin.com/v1/people/~/network/updates?scope=self

 

Which should get me all my own updates... however now I get an error:

 

401 1303487627487 0 [unauthorized]

 

I don't understand why I'm not authorized now? I do have access I guess, when the first example works?

What am I doing wrong here?

 

Thank you for your answer! If you need more information, please ask!

 

Link to comment
https://forums.phpfreaks.com/topic/234448-php-connection-to-linkedin/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.