Login   Register  
PHP Classes
elePHPant
Icontem

PHP OAuth class Post to user's LinkedIn Account

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP OAuth API  >  All threads  >  PHP OAuth class Post to user's LinkedIn Account  >  (Un) Subscribe thread alerts  
Subject:PHP OAuth class Post to user's LinkedIn Account
Summary:Having trouble creating the CALLAPI function correctly
Messages:50
Author:Bill Egan
Date:2012-12-13 15:48:55
Update:2014-01-08 21:28:41
 
  1 - 10   11 - 20   21 - 30   31 - 40   41 - 50  

  21. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-04-15 05:38:50 - In reply to message 20 from Alex Nikolov
The tokens remain stored in variables but are also saved to storage. It is all explained in the documentation.

Any calls to the API should be done using the CallAPI function.

  22. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Alex Nikolov
Alex Nikolov
2013-04-24 17:37:50 - In reply to message 21 from Manuel Lemos
So $client->access_token and $client->access_token_secret are the tokens that I need and they are already retrieved in the Initialize function. How long are they going to last? 60 days maybe ?

  23. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-04-24 20:55:42 - In reply to message 22 from Alex Nikolov
Either you set the token variables manually or you let the class retrieve them from some storage.

The default base class implementation uses sessions. That is not suitable for making calls to the API when the user is not present. So, if you do not set the variables manually before calling the class, you need to use a different storage for the tokens, like for instance a SQL database.

I have just published an article on this. Take a look here.

http://www.phpclasses.org/blog/package/7700/post/2-Offline-A ...

The tokens are not the only information that is stored. The class also stores for instance the expiry time for OAuth servers that limit the lifetime of a token.

The expiry time depends on the API. For LinkedIn it seems to be 60 days.

  24. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Alain Alain
Alain Alain
2013-04-26 10:33:07 - In reply to message 4 from Manuel Lemos
Hi Manuel,

Thank you for your answer :-) , it worked for me too

  25. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Alex Nikolov
Alex Nikolov
2013-04-28 12:39:58 - In reply to message 23 from Manuel Lemos
Hi great tutorial. I get the tokens and they are a valid ones.
I'm trying to use the CallAPI function to post a status remotely with the after I get the tokens, but it's not working for some reason.
Here is my code:

if(($success = $client->Initialize()))
{
if(($success = $client->Process()))
{
if(strlen($client->access_token))
{
$url = 'http://api.linkedin.com/v1/people/~/shares';
$method = 'POST';
$parameters = array('comment' => 'Some comment', 'content' => 'Some content', 'title' => 'Some title');
$options = array();
$success = $client->CallAPI($url, $method, $parameters, $options, $response);
}
}
$success = $client->Finalize($success);
}
I'm doing something wrong, but I cant find what, because it gives me back no errors.

  26. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-04-29 00:46:29 - In reply to message 25 from Alex Nikolov
You should check access_error or authorization_error to see why it is failing.

You may also want to set the debug variable and check your PHP error log file to see the dialog between the server and the client.

  27. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Asif Khan
Asif Khan
2013-08-16 07:10:26 - In reply to message 11 from Manuel Lemos
how to make simple post in linkedin using php can you help me

  28. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-08-16 07:23:35 - In reply to message 27 from Asif Khan
Where do you want to make that post?

You should check the LinkedIn API to determine what is the URL and parameters of the API call you need to make to submit the post. Then use the class LinkedIn example replacing the URL and parameters in the CallAPI function call.

https://developer.linkedin.com/apis

  29. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of david
david
2013-09-26 10:36:17 - In reply to message 28 from Manuel Lemos
hey manuel need some help to make an update remotely from my website to linked. Currently I am using the code below, am not getting errors but its not working

$parameters = new stdClass;
$parameters->comment = "Posting from the API using JSON";
$parameters->content = new stdClass;
$parameters->content->title = "A title for your share";
$parameters->content->{'submitted-url'} = "http://www.linkedin.com";
$parameters->content->{'submitted-image-url'} = "http://lnkd.in/Vjc5ec";
$parameters->visibility = new stdClass;
$parameters->visibility->code = 'anyone';
$success = $client->CallAPI(
'http://api.linkedin.com/v1/people/~/shares',
'POST', $parameters, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);

  30. Re: PHP OAuth class Post to user's LinkedIn Account   Reply   Report abuse  
Picture of david
david
2013-09-26 11:43:07 - In reply to message 29 from david
am now getting the following error

OAuth client error

Error: it was not possible to access the API call: it was returned an unexpected response status 403 Response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error> <status>403</status> <timestamp>1380195516217</timestamp> <request-id>8PQLYNUZVI</request-id> <error-code>0</error-code> <message>Access to posting shares denied</message> </error>

yet when I var_dump $client I have all the tokens required please help

 
  1 - 10   11 - 20   21 - 30   31 - 40   41 - 50