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

时间:2012-05-29 07:01:03

标签: php api linkedin

无论如何都要使用PHP通过API调用来更新linkedin公司页面的公司状态,

4 个答案:

答案 0 :(得分:3)

没有办法创建LinkedIn所指的“分享”#39;对于一家公司而言。 Here is a post on their forums与此有关。

答案 1 :(得分:2)

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

  1. 您必须在LinkedIn中拥有个人资料;
  2. 贵公司必须在LinkedIn(http://www.linkedin.com/company/yourcompanyname);
  3. 中拥有公司页面
  4. 您必须是公司页面的管理员(为了代表贵公司发布更新)。
  5. 满足上述条件后,请转至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());
    

    我希望它有所帮助。

答案 2 :(得分:2)

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

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

答案 3 :(得分:1)

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

Announcement

Official documentation