PHP Classes

PHP OAuth class Post to user's LinkedIn Account

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  PHP OAuth class Post to user's...  >  (Un) Subscribe thread alerts  
Subject:PHP OAuth class Post to user's...
Summary:Having trouble creating the CALLAPI function correctly
Messages:54
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   51 - 54  

  11. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-01-06 06:43:29 - In reply to message 10 from Arno Buizer
If you just want the Linked user unique id, send an API call to:

api.linkedin.com/v1/people/~:(id)

To get the e-mail address, the API call is different:

api.linkedin.com/v1/people/~/email- ...

To get the response in JSON format, which is decoded by the class, you need to have an entry in the $parameters array parameter of the CallAPI function set to:

'format'=>'json'

  12. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Arno Buizer Arno Buizer - 2013-01-06 11:39:56 - In reply to message 11 from Manuel Lemos
OK, thanks for your help. I wonder where to find al this info. (I got already lost in 'oauth'-land before I noticed your library!

I do however not get json data and I am using youre own example file, which I just modified for https and my secrets/ids etc.

with this:
$client->scope = 'r_fullprofile r_emailaddress';
..
$success = $client->CallAPI(
'http://api.linkedin.com/v1/people/~/email-address',
'GET', array(
'format'=>'json'
), array('FailOnAccessError'=>true), $user);

I get this:
you have logged in successfully with LinkedIn!
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<email-address>wow! my emailadres was here!</email-address>

which I can postprocess with something like:
$xml = simplexml_load_string(print_r($user, 1));
to get this:
SimpleXMLElement Object
(
[0] => arno.buizer@gmail.com
)

getName: email-address
nof_childs: 0
string: {my.emial@adres.here}

parsing the id data is more complex, but of coarse possible
but linkedin does not provide a unique id, so I have to fallback to less unique data like the first/lastname and separate available email.

That LinkedIn does not provide this info is of COARSE not a problem of your library.
oeps, just found out (by trying):

this:
'http://api.linkedin.com/v1/people/~/id', // but maybe this was what you ment to be used here....?
gives:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<id>a unique ID!</id>



Maybe the xml response to the json format request is a small problem within your lib.

Do you understand the need for the unique ID as also mentioned in message 8 by the other person?

Anyhow thank you very much for your library which already takes us a lot of work out of our hands!
Also your quick responses here are special and much appreciated!


  13. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-01-10 11:20:16 - In reply to message 12 from Arno Buizer
Usually I search the Web with Google because often somebody else already had the same issues and they were answered in developer forums.

There was an issue that would affect certain types of requests to LinkedIn that may be the cause to your JSON problem. I just uploaded a fixed version. Just let me know if you still have the problem.

  14. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Arno Buizer Arno Buizer - 2013-01-10 13:24:21 - In reply to message 13 from Manuel Lemos
Thank you again!
This update works fine (I only tested the LinkedIn change)!

with:
Arno Buizer you have logged in successfully with LinkedIn!
stdClass Object
(
[emailAddress] => arno.buizer@myprovider.com
[firstName] => Arno
[formattedName] => Arno Buizer
[id] => MyUniqueLinkedInID
[lastName] => Buizer
)

with this scope and api call:
$client->scope = 'r_basicprofile r_emailaddress'; // no full profile needed for my app.

api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,formatted-name)

NB. use the complete link above, the :( fields ) part at the end is LinkedIn Api format. In this message it is not recognized as a link over the whole line. The part in black IS also part of the link, instead of a comment at the end of the line!!!

with help of these pieces of documentation:
developer.linkedin.com/documents/fi ...
developer.linkedin.com/documents/pr ...

So now I understand your earlier answer with the ~:/(id) notation.
which is similar to: ~/id
the ~:/(field1,field2,etc) notation makes it possible to get just the fields you want to use.




  15. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Dhaval Sodha Parmar Dhaval Sodha Parmar - 2013-02-25 13:08:12 - In reply to message 4 from Manuel Lemos
what is $user???

  16. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-02-25 21:57:04 - In reply to message 15 from Dhaval Sodha Parmar
$user is a parameter passed by reference to the CallAPI function that will be assigned to the response of the API call if it succeeds.

  17. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Vadim Ferenets Vadim Ferenets - 2013-03-04 15:49:38 - In reply to message 14 from Arno Buizer
Arno Buizer - thanks for your idea. It is really working. picture-url is too!

  18. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of ivo san ivo san - 2013-03-19 11:40:22 - In reply to message 1 from Bill Egan
where is http.php?

  19. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-03-19 20:21:54 - In reply to message 18 from ivo san
It is listed in the dependencies section and also in the download page:

phpclasses.org/httpclient

  20. Re: PHP OAuth class Post to user's...   Reply   Report abuse  
Picture of Alex Nikolov Alex Nikolov - 2013-04-14 17:57:32 - In reply to message 9 from Manuel Lemos
Hi
How to get the access_token and access_token_secret after the authentication process and is there a function for the share API.
Thanks in advance.

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