Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Avoid getting the "Syntax error" from json_decode #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mnajafzadeh wants to merge 1 commit into zoonman:master
base: master
Choose a base branch
Loading
from mnajafzadeh:patch-1

Conversation

Copy link

@mnajafzadeh mnajafzadeh commented Nov 7, 2018
edited
Loading

Avoid getting the "Syntax error" from json_decode when LinkedIn API returns an empty response.

Avoid getting the "Syntax error" from json_decode when when LinkedIn API returns an empty response.
Copy link
Owner

zoonman commented Nov 7, 2018

@mnajafzadeh could you provide an example when you did run into such issue?

Copy link
Author

Hi @zoonman

An example can be, when you try to post a comment on a LinkedIn company page like:

$response = $client->post("companies/".$company_id."/updates/key=".$updateKey."/update-comments-as-company/", ['comment' => $message]);

This kind of requests have not any response if it is successful.

Thank you.

Copy link

👍

true
);
}
return array();
Copy link
Contributor

@iamsalnikov iamsalnikov Jan 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see in composer.json that we require PHP >= 5.6. So, I want to suggest change this line to return []. But this is not obligatory, just my small tip.

zoonman reacted with thumbs up emoji
Copy link

soisme commented Feb 1, 2019
edited
Loading

Hi @zoonman

An example can be, when you try to post a comment on a LinkedIn company page like:

$response = $client->post("companies/".$company_id."/updates/key=".$updateKey."/update-comments-as-company/", ['comment' => $message]);

This kind of requests have not any response if it is successful.

Thank you.

This is not the correct fix for your issue.

https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/ugc-post-api

The UGC Post is created with a 201 Created response and the response header X-RestLi-Id contains the ugcPost ID.

Linkedin does give response but it's in the header not body. We should parse the response correctly.

Copy link

Hi

In my case, the problem was resolved by changing the API Root URL to version 2.

 $this->client = new Client(
 env('LINKEDIN_CLIENT_ID'),
 env('LINKEDIN_CLIENT_SECRET')
 );
 $this->client->setApiRoot('https://api.linkedin.com/v2/');
 $this->client->setRedirectUrl(env('LINKEDIN_CALLBACK'));
reichert-lucas and mr-asad92 reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@iamsalnikov iamsalnikov iamsalnikov left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /