小编bal*_*eet的帖子

访问某些基本配置文件字段时,我收到likedin rest api的401 ssl必需错误

我正在使用rest api使用php代码从linkedin中获取基本个人资料数据。我能够成功生成访问代码和访问令牌,但是每当我尝试使用以下URL https://api.linkedin.com/v1/people/~?format=json获取基本配置文件时,都会收到ssl必需错误

我按照所有步骤进行了请求,如清单https://developer.linkedin.com/docs/oauth2所示

我使用非SSL网址作为回调参数,是否需要使用SSL网址?如果不是,那我为什么会收到这个错误。寻找解决方案

下面是获取配置文件字段的代码

$host = "api.linkedin.com";
$path = "/v1/people/~)";
//$arr = array('oauth2_access_token' => $access['access_token']);
$token = $access['access_token'];

  $header[] = "Authorization: Bearer ".$token;
  $header[] = "Connection: keep-alive"; 
  $header[] = "Keep-Alive: 300";


$ch = curl_init();

// endpoint url
curl_setopt($ch, CURLOPT_URL, $host . $path);

// set request as regular post
//curl_setopt($ch, CURLOPT_HTTPGET, true);

// set http version
curl_setopt($ch, CURLOPT_HTTP_VERSION, 'HTTP/1.1');

// set data to be send
//curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arr));

// set header
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

// set header …
Run Code Online (Sandbox Code Playgroud)

api rest ssl linkedin user-profile

1
推荐指数
1
解决办法
949
查看次数

标签 统计

api ×1

linkedin ×1

rest ×1

ssl ×1

user-profile ×1