file_get_contents返回NULL

时间:2018-07-16 11:49:05

标签: php linkedin file-get-contents

我正在尝试从LinkedIn获取一些数据,例如名字,姓氏。我使用下面的代码相同。但是我得到NULL作为响应。我尝试了SO和其他网站提供的一些解决方案,但没有一个起作用。

以下是我正在使用的代码:-

$url = 'http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-urls::(original),headline,public-profile-url,location,industry,positions,email-address)?format=json&outh2_access_token='.$accessToken;
        $user = file_get_contents($url,false);
        var_dump(json_decode($user));
        die();

下面是我得到的答复。

[16-Jul-2018 12:27:20 Europe/London] PHP Warning:  file_get_contents(http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-urls::(original),headline,public-profile-url,location,industry,positions,email-address)?format=json&outh2_access_token=###########): failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized

基本上我想要的是使用php从LinkedIn获取数据,如果有人这样做过,请与我分享解决方案。

0 个答案:

没有答案