-
Notifications
You must be signed in to change notification settings - Fork 115
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
Avoid getting the "Syntax error" from json_decode #29
base: master
Are you sure you want to change the base?
Conversation
Avoid getting the "Syntax error" from json_decode when when LinkedIn API returns an empty response.
@mnajafzadeh could you provide an example when you did run into such issue? |
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. |
👍 |
true | ||
); | ||
} | ||
return array(); |
There was a problem hiding this comment.
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.
This is not the correct fix for your issue.
Linkedin does give response but it's in the header not body. We should parse the response correctly. |
Hi In my case, the problem was resolved by changing the API Root URL to version 2.
|
Avoid getting the "Syntax error" from json_decode when LinkedIn API returns an empty response.