@@ -44,8 +44,8 @@ use LinkedIn\Client;
44
44
45
45
// instantiate the Linkedin client
46
46
$client = new Client(
47
- 'LINKEDIN_APP_CLIENT_ID',
48
- 'LINKEDIN_APP_CLIENT_SECRET '
47
+ 'YOUR_LINKEDIN_APP_CLIENT_ID',
48
+ 'YOUR_LINKEDIN_APP_CLIENT_SECRET '
49
49
);
50
50
```
51
51
@@ -144,19 +144,22 @@ $profile = $client->api(
144
144
);
145
145
```
146
146
147
- There are two helper methods:
147
+ There are 3 helper methods:
148
148
149
149
``` php
150
150
// get method
151
151
$client->get('ENDPOINT', ['param' => 'value']);
152
152
153
153
//post
154
154
$client->post('ENDPOINT', ['param' => 'value']);
155
+
156
+ // delete
157
+ $client->delete('ENDPOINT');
155
158
```
156
159
157
160
#### Examples
158
161
159
- Perform api call to get profile information
162
+ ##### Perform api call to get profile information
160
163
161
164
``` php
162
165
$profile = $client->get(
@@ -165,7 +168,7 @@ $profile = $client->get(
165
168
print_r($profile);
166
169
```
167
170
168
- List companies where you are an admin
171
+ ##### List companies where you are an admin
169
172
170
173
``` php
171
174
$profile = $client->get(
@@ -175,7 +178,9 @@ $profile = $client->get(
175
178
print_r($profile);
176
179
```
177
180
178
- Share content on a personal profile
181
+ ##### Share content on a personal profile
182
+
183
+ Make sure that image URL is available from the Internet (don't use localhost in the image url).
179
184
180
185
``` php
181
186
$share = $client->post(
@@ -193,9 +198,18 @@ $share = $client->post(
193
198
]
194
199
]
195
200
);
201
+ print_r($share);
202
+ ```
203
+
204
+ ##### Get Company page profile
205
+
206
+ ``` php
207
+ $companyId = '123'; // use id of the company where you are an admin
208
+ $companyInfo = $client->get('companies/' . $companyId . ':(id,name,num-followers,description)');
209
+ print_r($companyInfo);
196
210
```
197
211
198
- Share content on a LinkedIn business page
212
+ ##### Share content on a LinkedIn business page
199
213
200
214
``` php
201
215
// set sandboxed company page to work with
@@ -218,9 +232,12 @@ $share = $client->post(
218
232
]
219
233
]
220
234
);
235
+ print_r($share);
221
236
```
222
237
223
- Setup custom API request headers
238
+ ##### Setup custom API request headers
239
+
240
+ Change different headers sent to LinkedIn API.
224
241
225
242
``` php
226
243
$client->setApiHeaders([
@@ -231,15 +248,20 @@ $client->setApiHeaders([
231
248
]);
232
249
```
233
250
234
- Change default API root
251
+ ##### Change default API root
252
+
253
+ Some private API access there.
235
254
236
255
``` php
237
256
$client->setApiRoot('https://api.linkedin.com/v2/');
238
257
```
239
258
259
+ ##### Image Upload
260
+
261
+ I assume you have to be LinkedIn partner or something like that.
262
+
240
263
Try to upload image to LinkedIn. See [ Rich Media Shares] ( https://developer.linkedin.com/docs/guide/v2/shares/rich-media-shares#upload )
241
264
(returns "Not enough permissions to access media resource" for me).
242
- I assume you have to be LinkedIn partner or something like that.
243
265
244
266
``` php
245
267
$filename = '/path/to/image.jpg';
0 commit comments