【问题标题】:Can't post to LinkedIn via API无法通过 API 发布到 LinkedIn
【发布时间】:2016-02-18 15:02:43
【问题描述】:

这是我的代码:

 $url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=XXXXXXX';
$url .= '&format=json';

    $postdata = http_build_query(
                                 array(
                                        'comment' => 'comment',
                                        'content' => array('title' => 'LInkedIN title',
                                                        'description' => 'linkedin desc',
                                                        'submitted-url' => "https://developer.linkedin.com",
                                                            ),

                                        'visibility' => array('code' => 'anyone')
                                    )
                                );

    $opts =     array('http' =>
                                            array('method' => 'POST',

                                            'header'=> "x-li-format : json\r\n".
                                            "Host: api.linkedin.com\r\n".
                                            "Content-Length: ".strlen($postdata)."\r\n".
                                            "X-Target-URI: https://api.linkedin.com\r\n".
                                            "Content-Type: application/json\r\n".
                                            "Connection: Keep-Alive",

                                            'content' => $postdata

                                            )                           
                                        );

$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);

但是没有效果。尝试了这项服务https://apigee.com/console/linkedin - 完美运行...

怎么了?

【问题讨论】:

    标签: php api share linkedin posting


    【解决方案1】:

    您要构建什么? jssdk 可以做得更好!看看我开发的这个工具:

    http://datopstech.com/linkedin-share-tool/

    及源代码:

    https://github.com/kaburkett/LinkedIn-Advanced-Share

    如果可以的话,你的项目也应该以此为基础。

    【讨论】:

      猜你喜欢
      • 2020-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-11
      • 2019-07-05
      • 2014-04-15
      • 2022-06-22
      • 1970-01-01
      相关资源
      最近更新 更多