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

Commit 9013032

Browse files
authored
Update README.md
1 parent e19fd4e commit 9013032

File tree

1 file changed

+68
-37
lines changed

1 file changed

+68
-37
lines changed

‎README.md‎

Lines changed: 68 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ use LinkedIn\Scope;
8888
$scopes = [
8989
Scope::READ_LITE_PROFILE,
9090
Scope::READ_EMAIL_ADDRESS,
91-
Scope::MANAGE_COMPANY,
92-
Scope::SHARING,
91+
Scope::SHARE_AS_USER,
92+
Scope::SHARE_AS_ORGANIZATION,
9393
];
9494
$loginUrl = $client->getLoginUrl($scopes); // get url on LinkedIn to start linking
9595
```
@@ -167,7 +167,8 @@ $client->delete('ENDPOINT');
167167

168168
```php
169169
$profile = $client->get(
170-
'people/~:(id,email-address,first-name,last-name)'
170+
'me',
171+
['fields' => 'id,firstName,lastName']
171172
);
172173
print_r($profile);
173174
```
@@ -176,7 +177,7 @@ print_r($profile);
176177

177178
```php
178179
$profile = $client->get(
179-
'companies',
180+
'organizations',
180181
['is-company-admin' => true]
181182
);
182183
print_r($profile);
@@ -187,29 +188,44 @@ print_r($profile);
187188
Make sure that image URL is available from the Internet (don't use localhost in the image url).
188189

189190
```php
190-
$share = $client->post(
191-
'people/~/shares',
192-
[
193-
'comment' => 'Checkout this amazing PHP SDK for LinkedIn!',
194-
'content' => [
195-
'title' => 'PHP Client for LinkedIn API',
196-
'description' => 'OAuth 2 flow, composer Package',
197-
'submitted-url' => 'https://github.com/zoonman/linkedin-api-php-client',
198-
'submitted-image-url' => 'https://github.com/fluidicon.png',
199-
],
200-
'visibility' => [
201-
'code' => 'anyone'
202-
]
203-
]
204-
);
191+
$share = $client->post(
192+
'ugcPosts',
193+
[
194+
'author' => 'urn:li:person:' . $profile['id'],
195+
'lifecycleState' => 'PUBLISHED',
196+
'specificContent' => [
197+
'com.linkedin.ugc.ShareContent' => [
198+
'shareCommentary' => [
199+
'text' => 'Checkout this amazing PHP SDK for LinkedIn!'
200+
],
201+
'shareMediaCategory' => 'ARTICLE',
202+
'media' => [
203+
[
204+
'status' => 'READY',
205+
'description' => [
206+
'text' => 'OAuth 2 flow, composer Package.'
207+
],
208+
'originalUrl' => 'https://github.com/zoonman/linkedin-api-php-client',
209+
'title' => [
210+
'text' => 'PHP Client for LinkedIn API'
211+
]
212+
]
213+
]
214+
]
215+
],
216+
'visibility' => [
217+
'com.linkedin.ugc.MemberNetworkVisibility' => 'CONNECTIONS'
218+
]
219+
]
220+
);
205221
print_r($share);
206222
```
207223

208224
##### Get Company page profile
209225

210226
```php
211227
$companyId = '123'; // use id of the company where you are an admin
212-
$companyInfo = $client->get('companies/' . $companyId . ':(id,name,num-followers,description)');
228+
$companyInfo = $client->get('organizations/' . $companyId);
213229
print_r($companyInfo);
214230
```
215231

@@ -221,21 +237,36 @@ print_r($companyInfo);
221237
// https://www.linkedin.com/company/devtestco
222238
$companyId = '2414183';
223239

224-
$share = $client->post(
225-
'companies/' . $companyId . '/shares',
226-
[
227-
'comment' => 'Checkout this amazing PHP SDK for LinkedIn!',
228-
'content' => [
229-
'title' => 'PHP Client for LinkedIn API',
230-
'description' => 'OAuth 2 flow, composer Package',
231-
'submitted-url' => 'https://github.com/zoonman/linkedin-api-php-client',
232-
'submitted-image-url' => 'https://github.com/fluidicon.png',
233-
],
234-
'visibility' => [
235-
'code' => 'anyone'
236-
]
237-
]
238-
);
240+
$share = $client->post(
241+
'ugcPosts',
242+
[
243+
'author' => 'urn:li:organization:' . $companyId,
244+
'lifecycleState' => 'PUBLISHED',
245+
'specificContent' => [
246+
'com.linkedin.ugc.ShareContent' => [
247+
'shareCommentary' => [
248+
'text' => 'Checkout this amazing PHP SDK for LinkedIn!'
249+
],
250+
'shareMediaCategory' => 'ARTICLE',
251+
'media' => [
252+
[
253+
'status' => 'READY',
254+
'description' => [
255+
'text' => 'OAuth 2 flow, composer Package.'
256+
],
257+
'originalUrl' => 'https://github.com/zoonman/linkedin-api-php-client',
258+
'title' => [
259+
'text' => 'PHP Client for LinkedIn API'
260+
]
261+
]
262+
]
263+
]
264+
],
265+
'visibility' => [
266+
'com.linkedin.ugc.MemberNetworkVisibility' => 'PUBLIC'
267+
]
268+
]
269+
);
239270
print_r($share);
240271
```
241272

@@ -260,11 +291,11 @@ Some private API access there.
260291
$client->setApiRoot('https://api.linkedin.com/v2/');
261292
```
262293

263-
##### Image Upload
294+
##### ~Image Upload~
264295

265296
I assume you have to be LinkedIn partner or something like that.
266297

267-
Try to upload image to LinkedIn. See [Rich Media Shares](https://developer.linkedin.com/docs/guide/v2/shares/rich-media-shares#upload)
298+
Try to upload image to LinkedIn. See [Rich Media Shares](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/rich-media-shares)
268299
(returns "Not enough permissions to access media resource" for me).
269300

270301
```php

0 commit comments

Comments
(0)

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