简体   繁体   English

如何从我的公司页面获取Linkedin提要而无需用户进行身份验证

[英]How to fetch Linkedin feeds from my company page without user having to authenticate

I am trying to display my linkedin company page updates on my site as indicated here. 我试图在我的网站上显示我的linkedin公司页面更新,如此处所示。

https://developer.linkedin.com/reading-company-shares https://developer.linkedin.com/reading-company-shares

I downloaded the source from here http://thinkdiff.net/linkedin/integrate-linkedin-api-in-your-site/ 我从此处http://thinkdiff.net/linkedin/integrate-linkedin-api-in-your-site/下载了源代码

and the added the following method in linkedin.php 并在linkedin.php中添加了以下方法

function company($parameters)
    {
    //$search_url = $this->base_url."/v1/companies/{$parameters}/updates";
    //$search_url = $this->base_url . "/v1/people-search?keywords=facebook";
    $search_url = "https://api.linkedin.com/v1/companies/918677/updates?";



    echo "Performing search for: " . $parameters . "<br />";
    echo "Search URL: $search_url <br />";

    $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, "GET", $search_url);
    $request->sign_request($this->signature_method, $this->consumer, $this->access_token);
    $auth_header = $request->to_header("https://api.linkedin.com");
    print_r($auth_header);
    $response = $this->httpRequest($search_url, $auth_header, "GET");
    return $response;
}

I am unable to make it work. 我无法使其工作。 Also I am trying to show them without the user having to login. 我也试图显示它们而无需用户登录。 Is it possible ? 可能吗 ? Any same code or tutorial will be helpful. 任何相同的代码或教程都将有所帮助。

Thanks.. 谢谢..

First you have to get user token of linkedin user Use Socialite or REST API package for oauth . 首先,你必须获得用户令牌linkedin用户使用Socialite或REST API包oauth

Once you having user token it is pretty simple to fetch Company list under admin user 获得用户令牌后,在管理员用户下获取公司列表非常简单

$token = 'uflefjefheilhfbwrfliehbwfeklfw';    // user token
$api_url = "https://api.linkedin.com/v1/companies?oauth2_access_token=".$token."&format=json&is-company-admin=true";
$pages = json_decode(file_get_contents($api_url));

You have get $pages json array of list of company profile. 您将获得公司简介列表的$pages json数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM