php - 如何使用 Linkedin Api 获取所有 Linkedin 个人资料帖子
问题描述
我需要 LinkedIn API 来显示我从第一天开始发布的个人资料的提要。帖子包括媒体、图片、视频等。
我曾尝试使用 LinkedIn /share端点,但它返回如下错误,
[serviceErrorCode] => 0
[message] => Tunneled request must have 'Content-Type' header set to 'application/x-www-form-urlencoded' or 'multipart/mixed'
[status] => 400
这是代码:
$url="https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:person:".$linked_profile['id'];
$headers[] = 'X-HTTP-Method-Override: BATCH_GET';
$headers[] = 'X-Restli-Protocol-Version: 2.0.0';
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$headers[] = 'Authorization: Bearer ' .$_SESSION['linkedin_access_token'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
$result = json_decode($result,true);
如果有人以前这样做过,请提供帮助。谢谢。
解决方案
推荐阅读
- c# - 当只有读取操作时,可以将 DbContext 作为单例注入吗?
- c# - Selenium c# SendKeys 不发送字母符号
- java - 为什么 Java 9 集合工厂在支持可变参数时对每个参数都有单独的方法
- reactjs - 路由时,组件不在侧页中呈现
- javascript - 通过 MS Excel WebApp 中的 Office 脚本调用 API
- dialogflow-es - Google 助理 - askForPermission 从 Google 帐户获取用户电子邮件
- vue.js - 每次更改 VueJs 上的数据值时重做 api 调用
- gnuplot - gnuplot:在 GIF 终端中带有 3D 圆圈的视角相关颜色
- arduino - 用两个按钮运行两个 LED
- kubernetes - Openshift Cloudburst 工作节点到公共云?