Giter Club home page Giter Club logo

php-linkedin-sdk's People

Contributors

antongorodezkiy avatar antriver avatar ariponce avatar ashwinks avatar cbaldwin74 avatar chrisforrence avatar helloallan avatar jaffparker avatar mhmaguire avatar teedot-ashwin avatar tseho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-linkedin-sdk's Issues

Fatal error: Class 'LinkedIn' not found

Hi, I am using code like this and getting class not found error.
I already checked if the file is included correctly or not using get_included_files(), still this is happening.
Where I'm going wrong??

<?php

include 'lib/LinkedIn/LinkedIn.php';

print_r(get_included_files()); 
$li = new LinkedIn(
  array(
    'api_key' => 'myapikey', 
    'api_secret' => 'myapisecret', 
    'callback_url' => 'https://mydomain.com/redirecthere'
  )
);

?>

getAccessToken gives 500 error

I initiate the class as stated in the readme file like

$li = new LinkedIn(
  array(
    'api_key' => 'yourapikey', 
    'api_secret' => 'yourapisecret', 
    'callback_url' => 'https://yourdomain.com/redirecthere'
  )
);
$url = $li->getLoginUrl
(
  array(
    LinkedIn::SCOPE_BASIC_PROFILE, 
    LinkedIn::SCOPE_EMAIL_ADDRESS, 
    LinkedIn::SCOPE_NETWORK
  )
);
$token = $li->getAccessToken($_REQUEST['code']);

the getAccessToken function gives a 500 error.

When I print out the contents of $li, it says "_access_token:LinkedIn\LinkedIn:private".
Am I missing something?

Why does getAccessCode check for an existing access code when an authorization code is specified?

I'm confused as to why the getAccessCode($authorization_code) method always has to return a previously existing access code if one exists. It seems to me that if you specify an authorization code, it should request a new access token using that code regardless of whether or not the API has had an access token set.

I'm saving my access token, but of course I will have to request a new one periodically before it expires. I'd like to be able to do this without having to worry about whether or not I can set the access token beforehand (I have another custom class that is using the LI API and it tells the api to use the access token it has saved as soon as it instantiates).

Incorrect name of constant

The constant declarem in line 22, Linkedin\Linkedin::SCOPE_READ_WRTIE_UPDATES the should be SCOPE_READ_WRITE_UPDATES

Multiple Authorization error

A recent pull request has added the following line to the ->fetch() method

$headers[] = 'Authorization: Bearer ' . $this->getAccessToken();

This is now causing the LinkedIn API to error with the message "Mutiple authentication schemes detected" [sic] as the token is included both in a header and on the query string.

JSON Post failure

Thanks for this library! Easy to setup and has worked as expected up until now. Attempting to post to a share to linkedin but getting back:

Request Error: Can not parse JSON share document.
Request body:

Error:
null. Raw Response: Array
(
[errorCode] => 0
[message] => Can not parse JSON share document.
Request body:

Error:
null
[requestId] => *********
[status] => 400
[timestamp] => 1389818941824
)

seems that i may be formatting the json payload incorrectly, but as far as i can tell (the documentation on their json formatting is sparse) this should be correct

$linkedin->post('people/~/shares', array("comment"=>"This is a cool comment"));

The other thing i noticed while reading their documentation is that requests require a 'Content-Type: application/json' header. I can see that you have included the 'x-li-format: json' header but see no content type header. perhaps this is the problem?

Thanks again

SDK Error

Hi,

Since last week, I'm getting the following errors on authentication:

invalid_request -- missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired

It was working fine. Any changes in the API endpoints?

Thanks,

Can't work ashares in linkedin

after generation token and token expires save in database. Then makes new file and call api post for share but can't work in another file. It is work only same call back url file. I needs to new file in post.

POST method issue

I try to share using $li->post() method. but browser goes round and round after authorization. It doesn't do anything? any idea what am I doing wrong?

$li = new LinkedIn(
        array(
            'api_key' => 'myKey', 
            'api_secret' => 'mySecret', 
            'callback_url' => 'http://180.211.99.162:9051/widgetapi/oauth/linkedin'
        )
    );

    if(isset($_REQUEST['code'])) {

        $token = $li->getAccessToken($_REQUEST['code']);

        $result = $li->post("/people/~/shares", array(
                                                    "comment"=>"Check out developer.linkedin.com! http://linkd.in/1FC2PyG",
                                                    "visibility" => array("code" => "anyone")
                                                )
                                        );
        debug($result);
    } else {
        $loginUrl = $li->getLoginUrl(array(
                            LinkedIn::SCOPE_WRITE_SHARE
                        )
                    );
        $this->redirect($loginUrl);
    }
}

I debugged curl options and I got following parameters. And everything looks alright. but dont know why this is not working.

Array
(
    [10036] => POST
    [19913] => 1
    [10002] => https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=AQXR8IWG3tv1kJ3NxxTrfhX3Kv8CfTTbRSYNGlb0pBpkSBRp00Ee2lJiIdo4zcQOj5X00N7aJGGe3D2VLs3PPiB__lILvIsPbJ0G78MjfDfX-1-_9gvvmevLe2yDijyfyPiqUXyKdnn9InbwyejZe67omajLnISV9hJZPqBapSNemYMhlwk
    [10023] => Array
        (
            [0] => x-li-format: json
            [1] => Content-Length: 105
            [2] => Content-Type: application/json
        )

    [64] => 
    [52] => 1
    [78] => 20
    [47] => 1
    [10015] => {"comment":"Check out developer.linkedin.com! http:\/\/linkd.in\/1FC2PyG","visibility":{"code":"anyone"}}
)

Can't post to Share API

First of all great work! Somehow I can't get Share API to work with this.

I tried multiple parameter types and I always get this.

[errorCode] => 0
    [message] => Invalid xml {Expected elements &#39;post-network-update@http://api.linkedin.com/v1 id@http://api.linkedin.com/v1 visibility@http://api.linkedin.com/v1 ad-account@http://api.linkedin.com/v1 comment@http://api.linkedin.com/v1 attribution@http://api.linkedin.com/v1 mention@http://api.linkedin.com/v1 private-message@http://api.linkedin.com/v1 share-target-reach@http://api.linkedin.com/v1&#39; instead of &#39;visibilty@http://api.linkedin.com/v1&#39; here in element share@http://api.linkedin.com/v1}
    [requestId] => NC50O2WKV9
    [status] => 400
    [timestamp] => 1397323889255

This is how I set my $payload when doing a post request with php $this->LinkedIn->post($endpoint, $payload);

Array
(
    [comment] => 20+ Awesome Ways to Get More Followers for Your Google Plus Business Page - http://blog.kissmetrics.com/get-more-google-plus-followers/
    [content] => Array
        (
            [submitted-url] => http://blog.kissmetrics.com/get-more-google-plus-followers/
            [title] => Test
        )

    [visibilty] => Array
        (
            [code] => anyone
        )

)

The problem is not with auth. token, since I never get an error around that and I have pre-called php $this->LinkedIn->setAccessToken($creds['token']);.

Any guess on what it could be, is my $payload structured wrong? I gone over and over through Linkedins Share API docs, but I just don't see anything I could miss.

Thanks

My first Posting

Nice class,

at this far the authorisation went well.
So now I can get long-lived access_token for my webapp users and store these.

So next I'm trying to get my first post (acting as one of my users)
'cause there is little documentation, I try this, but getting:
Mutiple authentication schemes detected

Any help out there? TIA!!

cheers
Harry

$li = new LinkedIn(
array(
'api_key' => '_',
'api_secret' => '_
**',
'callback_url' => 'http://mydomain.nl/socnet.php'
)
);
$li->setAccessToken($storedusertoken);

$post = array(
'comment' => 'Test social Share',
'content' => array(
'title' => 'Test Title',
'description' => 'test description', //Maxlen(255)
'submitted_url' => 'http://tinyurl.com/z44rtdzo3f'
),
'visibility' => array(
'code' => 'anyone'
));
$post = $li->post('people/~/shares', $post);

            $post = $li->post('people/~/shares', $post);

Exception Handling not satisfying

Hello,

is it possible to get a better ExceptionHandling? The class only returns a RuntimeException. And the message is an array parsed into a string.

protected 'message' => string 'Request Error: Invalid access token.. Raw Response: Array
(
[errorCode] => 0
[message] => Invalid access token.
[requestId] => EZFSEK5QV1
[status] => 401
[timestamp] => 1424704122777
)

I mean, I could simplye RegEx the status to get a better status code, but this doesn't seem good practice. I like the class so far, however, reacting to errors is not satisfying.

Invalid access token

I'm getting the error invalid access token.

Here's more info: In response to the authorization I am told https://lifeboat.com/linkedin.post/?code=AQRS2NUSZAXDOX6pAaX5NAGxzm4rBqIpL95G-c31XRq9YULeeZ55TxTzb5IsBGj3Jt7SJNG2bIZj7x8zQdyRVxWMbhMPJBjflhWXM3OGQWNAVG28-rA&state=552e31c1156d94.09928605

So I set my authorization code to AQRS2NUSZAXDOX6pAaX5NAGxzm4rBqIpL95G-c31XRq9YULeeZ55TxTzb5IsBGj3Jt7SJNG2bIZj7x8zQdyRVxWMbhMPJBjflhWXM3OGQWNAVG28-rA and try

$token = $li->getAccessToken();
print "Token is $token\n";

$info = $li->get('/people/~:(first-name,last-name,positions)');

And get:

Token is AQRS2NUSZAXDOX6pAaX5NAGxzm4rBqIpL95G-c31XRq9YULeeZ55TxTzb5IsBGj3Jt7SJNG2bIZj7x8zQdyRVxWMbhMPJBjflhWXM3OGQWNAVG28-rA

PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Request Error: Invalid access token.. Raw Response: Array
(
[errorCode] => 0
[message] => Invalid access token.
[requestId] => B7DCHS9W2U
[status] => 401
[timestamp] => 1429091044022
)
' in /u/home/lifeboat/linkedin.post.php:364

Unable to work with library

Hey,
I'm having problem with using this library at all,

I basicly just added this at start:
include 'LinkedIn.php';

$li = new LinkedIn\LinkedIn(
array(
'api_key' => 'api_KEY',
'api_secret' => 'API_SECRETone',
'callback_url' => 'http://localhost/xampp/linkedin/'
)
);

which throw now error, but as soon as I try do something else like:
$token = $li->getAccessToken($_REQUEST['code']);

Error dispaly: Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Invalid authorization code. Pass in the "code" parameter from your callback url' in

Usage of code

As per the instructions, I included the LinkedIn class and then in my file created the LinkedIn object and then set the URL with $url = $....li->getLoginUrl().. i have set the parameters but its not redirecting me to the LinkedIn Authentication tab. Please please help. What am I doing wrong?

Add rw_company_admin to scopes

Love the wrapper, worked well for me.
However, I had to manually add rw_company_admin to the SCOPE_ constants to be able to post to a Company page. Perhaps you want to add it in the master? And companyId to the $_config array?

Time to tag a new release

It has been over two years since the last release and there have been some update to this project (new scopes in particular to my interest). Can you generate a new release so that these changes can be grabbed via composer with out resorting to using the dev-master?

Tutorials / Examples

Hi.

Are there any tutorials or examples on how to use this library? I've got it working so far as calling:

$linkedin -> fetch('/people/~/group-memberships'); but this only returns 10 groups. I'm guessing I add count = X to the payload parameter but that's just throwing an error.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.