如何使用 API 发布LinkedIn公司状态更新


How to Post LinkedIn Company status update using API?

无论如何都可以使用 PHP 通过 API 调用更新公司页面中链接的公司状态,

目前无法为公司创建LinkedIn所说的"股份"。这是他们论坛上与此相关的帖子。

这是一个非常快速的指南。看看我使用 LinkedIn API 的决定。请记住,在执行此操作之前:

  1. 您必须在LinkedIn拥有个人资料;
  2. 您的公司必须有一个LinkedIn的公司页面 (http://www.linkedin.com/company/yourcompanyname);
  3. 您必须是公司页面的管理员(才能代表公司发布更新)。

满足上述条件后,请转到 https://www.linkedin.com/secure/developer 并使用你的个人配置文件凭据登录。添加新应用程序以获取API密钥,密钥,OAuth用户令牌和OAuth用户密钥。

用于LinkedIn API 的 PHP 代码,用于发布公司股份:

require 'OAuth.php'; // .. or install the PECL extension.. Google it
$apiKey = 'xxxxxxx'; // take it from your application
$apiSecret = 'yyyyyyyyy'; // take it from your application
$accessToken = 'zzzzzzzzz'; // take it from your application
$accessToken = 'kkkkkkkkkkk'; // take it from your application
$oauth = new OAuth($apiKey, $apiSecret);
$oauth->setToken($accessToken, $accessTokenSecret);
$body = new stdClass();
$body->comment = 'Some comment';
$body->content = new stdClass();
$body->content->title = 'Some title';
$body->content->description = 'Some description';
$body->content->{'submitted-url'} = 'http://www.mycompany.com/article_id/123456'; // ID of your company page in LinkedIn
$body->visibility = new stdClass();
$body->visibility->code = 'anyone';
$body_json = json_encode($body);
$oauth->fetch('http://api.linkedin.com/v1/companies/12345678/shares', $body_json, OAUTH_HTTP_METHOD_POST, array(
  "Content-Type" => "application/json",
  "x-li-format" => "json"
));
$response = json_decode($oauth->getLastResponse());

我希望它有所帮助。

此问题的已接受答案不再有效,链接到该公告的另一个答案有两个断开的链接

为了澄清,您现在可以发布公司状态更新/共享,这方面的文档位于 https://developer.linkedin.com/docs/company-pages#company_share

截至 2013 年 8 月,LinkedIn 的 API 支持共享到公司页面。

公告。

官方文档。